is it possible when user subscribe by email after post request i want to send email
Thanks
@967118574445547650. I'll Try This.
can we send proper email template?
and is anything else that i have to do for send email to end user?
okay i'll try, Thanks
@967118574445547650hello
@967118574445547650we have tried with your given hook example but it's not working.
can you give me a full example or perfect reference.
we want to use google service for email
You can use a
beforeChange
or
afterChange
Hook that runs during a
create
operation on your collection.
Here is a code snippet example of a collection afterchange hook:
hooks: {
afterChange: [
({ operation, req }) => {
if (operation === 'create') {
req.payload.sendEmail({
to: 'john@doe.com',
from: 'test@test.com',
subject: 'Welcome!',
text: 'Thank you for subscribing',
});
}
},
],
},
sendEmail can accept an
html
property that can be a full email template you've created.
For email sending, you'll need to hook up a proper email service. Docs here:
https://payloadcms.com/docs/email/overview#email-functionalitybut it's not working.
You'll need to be more specific.
we want to use google service for email
You'll need to use nodemailer's OAuth2 transport in order to send email using Gmail. Their docs on configuration are here:
https://nodemailer.com/smtp/oauth2/In all honesty, unless you
really need to send emails from gmail, I'd recommend going with another provider for sending email like Resend, SendGrid, or similar. The OAuth configuration for nodemailer looks cumbersome.
Hey everyone, I’m new to this community. I’m working with Payload CMS and facing a problem with the replyTo header. I checked the inbox, but the replyTo is not there. thank you🙏
Star
Discord
online
Get dedicated engineering support directly from the Payload team.