🚑 (bot) Fix custom email from field without name
This commit is contained in:
@@ -23,7 +23,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
})
|
})
|
||||||
try {
|
try {
|
||||||
const info = await transporter.sendMail({
|
const info = await transporter.sendMail({
|
||||||
from: `"${from.name}" <${from.email}>`,
|
from: from.name ? `"${from.name}" <${from.email}>` : from.email,
|
||||||
to,
|
to,
|
||||||
subject: 'Your SMTP configuration is working 🤩',
|
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.🚀',
|
text: 'This email has been sent to test out your SMTP config.\n\nIf your read this then it has been successful.🚀',
|
||||||
|
|||||||
@@ -95,10 +95,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
return res.status(404).send({ message: "Couldn't find email body" })
|
return res.status(404).send({ message: "Couldn't find email body" })
|
||||||
}
|
}
|
||||||
const transporter = createTransport(transportConfig)
|
const transporter = createTransport(transportConfig)
|
||||||
|
const fromName = isEmpty(replyToName) ? from.name : replyToName
|
||||||
const email: Mail.Options = {
|
const email: Mail.Options = {
|
||||||
from: `"${isEmpty(replyToName) ? from.name : replyToName}" <${
|
from: fromName ? `"${fromName}" <${from.email}>` : from.email,
|
||||||
from.email
|
|
||||||
}>`,
|
|
||||||
cc,
|
cc,
|
||||||
bcc,
|
bcc,
|
||||||
to: recipients,
|
to: recipients,
|
||||||
|
|||||||
Reference in New Issue
Block a user