Email Functionality in payload- 2 (Use SMTP)

Use SMTP

Simple Mail Transfer Protocol (SMTP) options can be passed in using the transportOptions object on the email options. See the NodeMailer SMTP documentation for more information, including details on when secure should and should not be set to true.

payload.init({
  email: {
    transportOptions: {
      host: process.env.SMTP_HOST,
      auth: {
        user: process.env.SMTP_USER,
        pass: process.env.SMTP_PASS,
      },
      port: Number(process.env.SMTP_HOST),
      secure: Number(process.env.SMTP_PORT) === 465, // true for port 465, false (the default) for 587 and others
      requireTLS: true,
    },
    fromName: 'hello',
    fromAddress: 'hello@example.com',
  },
  // ...
})

Leave a comment

Your email address will not be published. Required fields are marked *