Skip to content

Send emails using Gmail

Sukhpal Saini edited this page Jul 26, 2021 · 1 revision

Candymail supports all SMTP email services. Gmail is the easiest to set up since everyone has a Google Account.

Gmail should only be used for testing or debugging purposes. In production, consider using a service like Amazon SES, Sendgrid etc that offers SMTP for better deliverability.

Set up

  • Sign up for an App Password for Gmail here

Add to Candymail config

Initialize Candymail config with Gmail STMP. The user is your Gmail email address and the pass is the App Password you just geenrated.

candymail.init(automation.workflows, {
  mail: {
    host: 'smtp.gmail.com',
    port: 465,
    secure: true,
    auth: {
      user: process.env.MAIL_USER,
      pass: process.env.MAIL_PASSWORD,
    },
    tls: {
      rejectUnauthorized: true,
    },
  },
  hosting: { url: process.env.HOSTING_URL },
  db: { reset: true },
  debug: { trace: true },
})
Clone this wiki locally