node.js - Nodemailer without Gmail -
i'm using nodejs , want configure email account nodemailer.
all nodemailer examples found gmail...
var transporter = nodemailer.createtransport({ service: 'gmail', auth: { user: 'gmail.user@gmail.com', pass: 'userpass' } }); how can put service? in special bought email domain in ovh (ssl0.ovh.net) , interested configure email account.
i tried don't found way this...
thank you!
i create module mail send html mails smtp
exports.send = function(email, subject, htmlcontent, callback) { var nodemailer = require('nodemailer'); var smtptransport = require('nodemailer-smtp-transport'); var configmail = require('../bin/config').mail;//my json configurations mail var transporter = nodemailer.createtransport(smtptransport({ host: configmail.host, //mail.example.com (your server smtp) port: configmail.port, //2525 (specific port) secureconnection: configmail.secureconnection, //true or false auth: { user: configmail.auth.user, //user@mydomain.com pass: configmail.auth.pwd //password specific user mail } })); var mailoptions = { from: configmail.email, to: email, subject: subject, html: htmlcontent }; transporter.sendmail(mailoptions, function(err, info){ transporter.close(); if(err) { callback(err, info); } else { callback(null, info); } }); } the usage:
var mail = require('../utils/mail'); //require module mail.send('[email send]', '[title]', '[your html template mail]', function(err, info) { if(err) { //error } else { //email has been sent , can see information in var info } });
Comments
Post a Comment