feat(integration): ♿️ Add reply-to name on from field
This commit is contained in:
@ -67,6 +67,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
resultValues: ResultValues
|
||||
fileUrls?: string
|
||||
}
|
||||
const replyToName = replyTo?.split(' <')[0].replace(/"/g, '')
|
||||
|
||||
const { host, port, isTlsEnabled, username, password, from } =
|
||||
(await getEmailInfo(credentialsId)) ?? {}
|
||||
@ -104,7 +105,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
}
|
||||
const transporter = createTransport(transportConfig)
|
||||
const email: Mail.Options = {
|
||||
from: `"${from.name}" <${from.email}>`,
|
||||
from: `"${replyToName ?? from.name}" <${from.email}>`,
|
||||
cc,
|
||||
bcc,
|
||||
to: recipients,
|
||||
|
@ -294,7 +294,6 @@ const sendEmail = async (
|
||||
return block.outgoingEdgeId
|
||||
}
|
||||
const { options } = block
|
||||
const replyTo = parseVariables(variables)(options.replyTo)
|
||||
const { error } = await sendRequest({
|
||||
url: `${apiHost}/api/typebots/${typebotId}/integrations/email?resultId=${resultId}`,
|
||||
method: 'POST',
|
||||
@ -305,7 +304,9 @@ const sendEmail = async (
|
||||
body: parseVariables(variables)(options.body ?? ''),
|
||||
cc: (options.cc ?? []).map(parseVariables(variables)),
|
||||
bcc: (options.bcc ?? []).map(parseVariables(variables)),
|
||||
replyTo: replyTo !== '' ? parseVariables(variables)(replyTo) : undefined,
|
||||
replyTo: options.replyTo
|
||||
? parseVariables(variables)(options.replyTo)
|
||||
: undefined,
|
||||
fileUrls: variables.find(byId(options.attachmentsVariableId))?.value,
|
||||
isCustomBody: options.isCustomBody,
|
||||
isBodyCode: options.isBodyCode,
|
||||
|
Reference in New Issue
Block a user