Links

Send emails using Gmail

Send emails using Gmail
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.

Setup a new account

If you have 2-step authentication for your Google Account turned on:

  1. 1.
    Sign up for an App Password for Gmail here
  2. 2.
    Your user will be your email and password will be the App Password

If you don't have 2-step authentication on your Google Account:

  1. 1.
    Allow access for less secure apps here
  2. 2.
    Your user will be your email and password will be your usual login password

Initialize Candymail

Initialize Candymail config with Gmail STMP. The user is your Gmail email address and the pass is the App Password you just generated.
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 },
})

Add Env Vars

Create a .env:
MAIL_PASSWORD=password
HOSTING_URL=http://localhost:3000