Dynamic Email Configuration Using Globals #12783
Replies: 2 comments
-
|
Hi! I tried a few methods, this one seems to work fine for me. I'm using resend but I don't see why it couldn't work with Nodemailer. `import { BasePayload, getPayload } from 'payload' export const emailConfig = async (payload: BasePayload) => { // Create the EmailAdapter factory // Initialize the EmailAdapter factory with the context (=> InitializedEmailAdapter) // Sobstitute the instance used by Payload at runtime export const sendEmailFromPayload = async ({ It surely could be done in a better way, but I'm not that expert. |
Beta Was this translation helpful? Give feedback.
-
|
Hey @only-issues, I've already implemented exactly what you need in my payload-ecommerce-template But from my experiences you are not able to reinitialize original |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello PayloadCMS community and team,
Currently, I notice that email configuration is required during startup, which means the email settings must be hard-coded or stored in the .env file. Is there a way to store email configuration in Globals instead? I would like the
nodemailerAdapterto automatically reinitialize with the new email settings whenever I update the email configuration in Globals.Beta Was this translation helpful? Give feedback.
All reactions