feat(smtp-notification): add missing from name param to form
This commit is contained in:
parent
93aabebd51
commit
6f07f0e204
3 changed files with 17 additions and 1 deletions
|
|
@ -82,6 +82,20 @@ export const EmailForm = ({ form }: Props) => {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="fromName"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>From Name (Optional)</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input {...field} placeholder="Zerobyte Backup" />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>The display name shown in the email client.</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="to"
|
name="to"
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ export const emailNotificationConfigSchema = type({
|
||||||
username: "string?",
|
username: "string?",
|
||||||
password: "string?",
|
password: "string?",
|
||||||
from: "string",
|
from: "string",
|
||||||
|
fromName: "string?",
|
||||||
to: "string[]",
|
to: "string[]",
|
||||||
useTLS: "boolean",
|
useTLS: "boolean",
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ export const buildEmailShoutrrrUrl = (config: Extract<NotificationConfig, { type
|
||||||
const host = `${config.smtpHost}:${config.smtpPort}`;
|
const host = `${config.smtpHost}:${config.smtpPort}`;
|
||||||
const toRecipients = config.to.map((email) => encodeURIComponent(email)).join(",");
|
const toRecipients = config.to.map((email) => encodeURIComponent(email)).join(",");
|
||||||
const useStartTLS = config.useTLS ? "yes" : "no";
|
const useStartTLS = config.useTLS ? "yes" : "no";
|
||||||
|
const fromNameParam = config.fromName ? `&fromname=${encodeURIComponent(config.fromName)}` : "";
|
||||||
|
|
||||||
return `smtp://${auth}${host}/?from=${encodeURIComponent(config.from)}&to=${toRecipients}&starttls=${useStartTLS}`;
|
return `smtp://${auth}${host}/?from=${encodeURIComponent(config.from)}${fromNameParam}&to=${toRecipients}&starttls=${useStartTLS}`;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue