Repository: louislam/uptime-kuma
File: server/notification-providers/brevo.js (JavaScript)

Code before:
            let bcc = undefined;
            if (notification.brevoBccEmail) {
                bcc = notification.brevoBccEmail
                    .split(",")
                    .map((email) => ({ email: email.trim() }));
            }

            let data = {
                sender: {
                    email: notification.brevoFromEmail.trim(),
                    name: notification.brevoFromName || "Uptime Kuma"
                },
                to: to,
                subject: notification.brevoSubject || "Notification from Your Uptime Kuma",
                htmlContent: `<html><head></head><body><p>${msg.replace(/\n/g, "<br>")}</p></body></html>`
            };

            // Add CC if provided
            if (cc) {
                data.cc = cc;
            }

            // Add BCC if provided
            if (bcc) {
                data.bcc = bcc;
            }

            let result = await axios.post(
                "https://api.brevo.com/v3/smtp/email",
                data,
                config
            );
            if (result.status === 201) {
                return okMsg;
            } else {
                throw new Error(`Unexpected status code: ${result.status}`);
            }
        } catch (error) {
            this.throwGeneralAxiosError(error);
        }
    }
}

module.exports = Brevo;


Review comment (suggestion):
lets inline here

```suggestion
            let data = {
                sender: {
                    email: notification.brevoFromEmail.trim(),
                    name: notification.brevoFromName || "Uptime Kuma"
                },
                to: to,
                subject: notification.brevoSubject || "Notification from Your Uptime Kuma",
                htmlContent: `<html><head></head><body><p>${msg.replace(/\n/g, "<br>")}</p></body></html>`
            };

            if (notification.brevoCcEmail) {
                data.cc = notification.brevoCcEmail
                    .split(",")
                    .map((email) => ({ email: email.trim() }));
            }

            if (notification.brevoBccEmail) {
                data.bcc = notification.brevoBccEmail
                    .split(",")
                    .map((email) => ({ email: email.trim() }));
            }
```

Code after:

            if (notification.brevoCcEmail) {
                data.cc = notification.brevoCcEmail
                    .split(",")
                    .map((email) => ({ email: email.trim() }));
            }

            if (notification.brevoBccEmail) {
                data.bcc = notification.brevoBccEmail
                    .split(",")
                    .map((email) => ({ email: email.trim() }));
            }

            let result = await axios.post(
                "https://api.brevo.com/v3/smtp/email",
                data,
                config
            );
            if (result.status === 201) {
                return okMsg;
            } else {
                throw new Error(`Unexpected status code: ${result.status}`);
            }
        } catch (error) {
            this.throwGeneralAxiosError(error);
        }
    }
}

module.exports = Brevo;