diff --git a/__mocks__/data.ts b/__mocks__/data.ts index 9fc5652..f606b7a 100644 --- a/__mocks__/data.ts +++ b/__mocks__/data.ts @@ -69,6 +69,7 @@ export const dummySettings = { notification_interval: 'never', notification_email: '', notification_email_from: '', + notification_email_from_name: 'SerpBear', smtp_server: '', smtp_port: '', smtp_username: '', diff --git a/components/settings/NotificationSettings.tsx b/components/settings/NotificationSettings.tsx index 8cfc15a..dc762fd 100644 --- a/components/settings/NotificationSettings.tsx +++ b/components/settings/NotificationSettings.tsx @@ -89,6 +89,15 @@ const NotificationSettings = ({ settings, settingsError, updateSettings }:Notifi onChange={(value:string) => updateSettings('notification_email_from', value)} /> +
+ updateSettings('notification_email_from_name', value)} + /> +
)} diff --git a/components/settings/Settings.tsx b/components/settings/Settings.tsx index 8f0038a..97b0d34 100644 --- a/components/settings/Settings.tsx +++ b/components/settings/Settings.tsx @@ -28,6 +28,7 @@ const defaultSettings: SettingsType = { smtp_username: '', smtp_password: '', notification_email_from: '', + notification_email_from_name: 'SerpBear', search_console: true, search_console_client_email: '', search_console_private_key: '', diff --git a/pages/api/notify.ts b/pages/api/notify.ts index 3f4ca96..f76e43d 100644 --- a/pages/api/notify.ts +++ b/pages/api/notify.ts @@ -62,9 +62,10 @@ const sendNotificationEmail = async (domain: Domain, settings: SettingsType) => smtp_password = '', notification_email = '', notification_email_from = '', + notification_email_from_name = 'SerpBear', } = settings; - const fromEmail = `SerpBear <${notification_email_from || 'no-reply@serpbear.com'}>`; + const fromEmail = `${notification_email_from_name} <${notification_email_from || 'no-reply@serpbear.com'}>`; const mailerSettings:any = { host: smtp_server, port: parseInt(smtp_port, 10) }; if (smtp_username || smtp_password) { mailerSettings.auth = {}; diff --git a/pages/api/settings.ts b/pages/api/settings.ts index d684c0d..79aca51 100644 --- a/pages/api/settings.ts +++ b/pages/api/settings.ts @@ -119,6 +119,7 @@ export const getAppSettings = async () : Promise => { notification_interval: 'never', notification_email: '', notification_email_from: '', + notification_email_from_name: 'SerpBear', smtp_server: '', smtp_port: '', smtp_username: '',