Improve email branding and SMTP envelope
This commit is contained in:
+11
-1
@@ -30,5 +30,15 @@ export function getMailTransport(): nodemailer.Transporter {
|
||||
}
|
||||
|
||||
export function getMailFrom(): string {
|
||||
return process.env.SMTP_FROM || "ANOUMA <support@anouma.org>";
|
||||
const configured = (process.env.SMTP_FROM || process.env.SMTP_USER || "support@anouma.org").trim();
|
||||
const unquoted = configured.replace(/^("|')(.*)\1$/, "$2").trim();
|
||||
|
||||
// Keep the address in the message header, but show only ANOUMA in mail clients.
|
||||
if (unquoted.includes("<") && unquoted.includes(">")) return unquoted;
|
||||
return `ANOUMA <${unquoted}>`;
|
||||
}
|
||||
|
||||
/** Envelope sender used by strict SMTP relays for sender ownership checks. */
|
||||
export function getMailEnvelopeFrom(): string {
|
||||
return process.env.SMTP_USER || "support@anouma.org";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user