Hello, this is my code right now, I've got all the emails, but I'm confused with setting up the nodemailer part. I have my own STMP server with SSL, port: 465. How would I go setting it up?
const Posts: CollectionConfig = {
// fields, admin and such
hooks: {
afterChange: [
async (args) => {
const emails = await payload
.find({
collection: "newsletter-emails",
where: {
and: [
{
unsub: {
equals: false,
},
},
],
},
limit: 9999,
})
.then((res) => res.docs);
},
],
},
};
export default Posts;
You would configure a nodemailer SMTP transport as documented here:
https://nodemailer.com/smtp/
Then you'd pass that email transport in your config
email
property or in
init
. Both are supported.
Yep, thanks- I've done that but the reason for not working was I misspelled
STMP
, wrote
SMTP
insread
Star
Discord
online
Get dedicated engineering support directly from the Payload team..