I like how you are instantiating the mail feature through the global settings manually instead of using the plugin itself.
|
export const sendEmail = async ({ to, subject, html }: EmailPayload): Promise<EmailResponse> => { |
|
const { transporter, fromEmail } = await createEmailTransporter(); |
|
|
|
try { |
|
const { messageId } = await transporter.sendMail({ |
|
from: fromEmail, |
|
to, |
|
subject, |
|
html, |
|
}); |
|
|
|
return { success: true, messageId }; |
|
} catch (error) { |
|
const errorMessage = error instanceof Error ? error.message : "Unknown email error"; |
|
throw new Error(`Failed to send email: ${errorMessage}`); |
|
} |
|
}; |
However, it doesn't work with the form builder plugin. Form builder plugin still uses the mail configuration defined in the Payload config. There's no email: {} configuration defined in the Payload config at this point thus, form builder email won't work.
How are we going to override the form builder plugin's mail configuration to ensure it uses the customer mail configuration instead?
I like how you are instantiating the mail feature through the global settings manually instead of using the plugin itself.
payload-ecommerce-template/src/utilities/nodemailer.ts
Lines 32 to 48 in d9307e9
However, it doesn't work with the form builder plugin. Form builder plugin still uses the mail configuration defined in the Payload config. There's no
email: {}configuration defined in the Payload config at this point thus, form builder email won't work.How are we going to override the form builder plugin's mail configuration to ensure it uses the customer mail configuration instead?