Category : nodemailer

I am trying to send email from my Nodejs, Express API. But it is showing message: “connect ECONNREFUSED 74.125.137.109:465” name: “Error when I am using configuration like service: ‘Gmail’ or ‘smtp.gmail.com’, or host: ‘mail.gmail.com’ port: 465, secure: true, // true for 465, false for other ports auth: { user: process.env.EMAIL_USER, // generated ethereal user pass: ..

Read more

const doc = [{id: 2, title: ‘hello word’, email: ‘[email protected]’},{id: 3, title: ‘post data’}, email: ‘[email protected]’}] { doc.map(data => { var readHTMLFile = function (path, callback) { fs.readFile(path, { encoding: ‘utf-8’ }, function (err, html) { if (err) { throw err; callback(err); } else { callback(null, html); } }); }; readHTMLFile(__dirname + ‘/../emailTemplates/newsletter.html’, function (err, ..

Read more

i try to send beautifuls mails in Node.js with Nodemails but it gives the error when i add a template. there is my code require(‘dotenv’).config(); const nodemailer = require(‘nodemailer’); const hbs = require(‘nodemailer-handlebars’); const log = console.log; // Step 1 let transporter = nodemailer.createTransport({ service: ‘gmail’, auth: { user: ‘[email protected]’, pass: ‘……’ } }); // ..

Read more

To display an image in an email generated with Nodemailer, I use the attachments method: var mailOptions = { from: this.senderEmail, to: this.receiverEmail, subject: subject, html: content, attachments: [ { filename: "source_text_white.png", path: __dirname + "/assets/images/source_text_white.png", cid: "im_logo_source_text", }, … HTML: <img src="cid:im_logo_source_text" alt="Logo Source App" width="200" style="display: block; margin-left: auto; margin-right: auto" loading="lazy"/> The ..

Read more