forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.67k stars 337 forks source link

Send mail in dev mod #249

Closed duard closed 7 years ago

duard commented 7 years ago

How can I send mails in development mode ? I try this config but I only saw my emails in my console and not receive them in my gmail :

import config from '../../config/config';

const nodemailer = require('nodemailer');
const EmailTemplate = require('email-templates');

const transporter = nodemailer.createTransport({
  service: 'gmail',
  port: 587,
  secure: false, 
  auth: {
    user: config.mail.user,
    pass: config.mail.pass
  }
});

const emailEngine = new EmailTemplate({
  message: {
    from: 'goiabadasamarelinhas@gmail.com'
  },
  transport: transporter,
  preview: false,
});

Thanks.

duard commented 7 years ago

The solution is use send: true

const emailEngine = new EmailTemplate({
  message: {
    from: 'goiabadasamarelinhas@gmail.com'
  },
  transport: transporter,
  preview: false,
  send : true
});