Im using nodemailer to send emails especially to outlook .
UPDATE:
With below code im getting Error: Message failed error
var nodemailer = require('nodemailer');
// create reusable transporter object using the default SMTP transport
let transporter = nodemailer.createTransport({
host: 'smtp.office365.com',
port: 587,
secureConnection: false, // secure:true for port 465, secure:false for port 587
auth: {
user: 'user@domain.com',
pass: 'password'
},
tls: { ciphers: 'SSLv3' }
});
// setup email data with unicode symbols
let mailOptions = {
from: '"Fred Foo " <foo@blurdybloop.com>', // sender address
to: 'myemail@companydomain.com', // list of receivers
subject: 'Hello ✔', // Subject line
text: 'Hello world ?', // plain text body
html: '<b>Hello world ?</b>' // html body
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
return console.log(error);
}
console.log('Message %s sent: %s', info.messageId, info.response);
});
Full error trace:
Error: Message failed: 550 5.7.60 SMTP; Client does not have permissions to send as this sender [SG2PR06MB1725.apcprd06.prod.outlook.com] at SMTPConnection._formatError (/var/www/html/Express/Local-MEAN-dev/node_modules/nodemailer/lib/smtp-connection/index.js:557:19) at SMTPConnection._actionSMTPStream (/var/www/html/Express/Local-MEAN-dev/node_modules/nodemailer/lib/smtp-connection/index.js:1385:34) at SMTPConnection._responseActions.push.str (/var/www/html/Express/Local-MEAN-dev/node_modules/nodemailer/lib/smtp-connection/index.js:907:22) at SMTPConnection._processResponse (/var/www/html/Express/Local-MEAN-dev/node_modules/nodemailer/lib/smtp-connection/index.js:706:20) at SMTPConnection._onData (/var/www/html/Express/Local-MEAN-dev/node_modules/nodemailer/lib/smtp-connection/index.js:509:14) at TLSSocket._socket.on.chunk (/var/www/html/Express/Local-MEAN-dev/node_modules/nodemailer/lib/smtp-connection/index.js:657:51) at emitOne (events.js:96:13) at TLSSocket.emit (events.js:191:7) at readableAddChunk (_stream_readable.js:176:18) at TLSSocket.Readable.push (_stream_readable.js:134:10) at TLSWrap.onread (net.js:563:20) code: 'EMESSAGE', response: '550 5.7.60 SMTP; Client does not have permissions to send as this sender [SG2PR06MB1725.apcprd06.prod.outlook.com]', responseCode: 550, command: 'DATA' }