2
0

🚑 (bot) Fix custom email from field without name

This commit is contained in:
Baptiste Arnaud
2022-11-15 17:50:56 +01:00
parent 087d24e587
commit 4e6b8ed521
2 changed files with 3 additions and 4 deletions

View File

@ -23,7 +23,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
})
try {
const info = await transporter.sendMail({
from: `"${from.name}" <${from.email}>`,
from: from.name ? `"${from.name}" <${from.email}>` : from.email,
to,
subject: 'Your SMTP configuration is working 🤩',
text: 'This email has been sent to test out your SMTP config.\n\nIf your read this then it has been successful.🚀',

View File

@ -95,10 +95,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
return res.status(404).send({ message: "Couldn't find email body" })
}
const transporter = createTransport(transportConfig)
const fromName = isEmpty(replyToName) ? from.name : replyToName
const email: Mail.Options = {
from: `"${isEmpty(replyToName) ? from.name : replyToName}" <${
from.email
}>`,
from: fromName ? `"${fromName}" <${from.email}>` : from.email,
cc,
bcc,
to: recipients,