feat: Adds ability to set Notification Email From name.

closes #222
This commit is contained in:
towfiqi
2024-11-07 21:15:12 +06:00
parent a09eb62f5a
commit b35d333bfc
5 changed files with 14 additions and 1 deletions

View File

@@ -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: '',

View File

@@ -89,6 +89,15 @@ const NotificationSettings = ({ settings, settingsError, updateSettings }:Notifi
onChange={(value:string) => updateSettings('notification_email_from', value)}
/>
</div>
<div className="settings__section__input mb-5">
<InputField
label='Email From Name'
hasError={settingsError?.type === 'no_smtp_from'}
value={settings?.notification_email_from_name || 'Serpbear'}
placeholder="Serpbear"
onChange={(value:string) => updateSettings('notification_email_from_name', value)}
/>
</div>
</>
)}

View File

@@ -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: '',

View File

@@ -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 = {};

View File

@@ -119,6 +119,7 @@ export const getAppSettings = async () : Promise<SettingsType> => {
notification_interval: 'never',
notification_email: '',
notification_email_from: '',
notification_email_from_name: 'SerpBear',
smtp_server: '',
smtp_port: '',
smtp_username: '',