Include the following information with your issue:
node version: v6.8.1
,
nodemailer version: [email protected]
,
os x sierra: Darwin Kernel Version 16.1.0
,
my code:
`app.post('/contact', (req, res) => {
var transporter = nodemailer.createTransport({
host: "smtp-mail.outlook.com",
secureConnection: true,
port: 587,
tls: {
ciphers: 'starttls'
},
service: 'hotmail',
auth: {
user: 'email',
pass: 'Passwd'
}
});
var sender = req.body.email;
var sujet = req.body.sujet;
var texte = req.body.message;
var mailOptions = {
from: sender,
to: 'email',
subject: sujet,
text: texte
//html: '
le formulaire marche'
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
return console.error(error);
} else {
console.log('Message %s envoyer: %s', info.messageId, info.response);
}
});
res.send('req recieved');
});`
my error in the console: POST /contact 200 40.613 ms - 12
{ Error: Message failed: 550 5.3.4 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:69000000, 17.43559:0000000020010000000000000000000000000000, 20.521
at SMTPConnection._formatError (/Users/macair/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:555:19)
at SMTPConnection._actionSMTPStream (/Users/macair/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:1376:34)
at SMTPConnection._responseActions.push.str (/Users/macair/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:903:22)
at SMTPConnection._processResponse (/Users/macair/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:702:20)
at SMTPConnection._onData (/Users/macair/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:507:14)
at TLSSocket._socket.on.chunk (/Users/macair/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:653:51)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at TLSSocket.Readable.push (_stream_readable.js:134:10)
code: 'EMESSAGE',
response: '550 5.3.4 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:69000000, 17.43559:0000000020010000000000000000000000000000, 20.521',
responseCode: 550,
command: 'DATA' }
This usually happens when you try to send emails from an address that you are not authorized to use, eg your user is "[email protected]" but you try to send mails as "[email protected]".
thank you for quickly reply ! :)
Le mer. 15 mars 2017 Ã 11:14, Andris Reinman notifications@github.com a
écrit :
Closed #748 https://github.com/nodemailer/nodemailer/issues/748.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nodemailer/nodemailer/issues/748#event-1000603376,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALCcHcgYBxAWS_5W1fUKal79yzK4Liqtks5rl7npgaJpZM4Mdu5v
.
i'm still with the same error, i can send email with the same config but can't recieve email. here is the error i get same as mentioned up:
my config:
app.post('/contact', (req, res) => {
var transporter = nodemailer.createTransport({
service: 'outlook',
host: "smtp-mail.outlook.com", // hostname
secureConnection: false, // TLS requires secureConnection to be false
port: 587,
tls: {
rejectUnauthorized: false
},
auth: {
user: '[email protected]',
pass: 'passwd'
}
});
var sender = req.body.email;
var sujet = req.body.sujet;
var texte = req.body.message;
var outlook = '[email protected]';
var gmail = '[email protected]';
var mailOptions = {
from: gmail,
to: outlook,
subject: sujet,
text: texte,
html: '<p>le formulaire marche</p>'
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
return console.error(error);
} else {
console.log('Message %s envoyer: %s', info.messageId, info.response);
}
});
res.send('req recieved');
transporter.close();
});
{ Error: Message failed: 550 5.3.4 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:69000000, 17.43559:0000000048010000000000000800000000000000, 20.521
at SMTPConnection._formatError (/home/curlynux/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:555:19)
at SMTPConnection._actionSMTPStream (/home/curlynux/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:1376:34)
at SMTPConnection._responseActions.push.str (/home/curlynux/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:903:22)
at SMTPConnection._processResponse (/home/curlynux/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:702:20)
at SMTPConnection._onData (/home/curlynux/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:507:14)
at TLSSocket._socket.on.chunk (/home/curlynux/Documents/express-khasso/node_modules/nodemailer/lib/smtp-connection/index.js:653:51)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:189:7)
at readableAddChunk (_stream_readable.js:176:18)
at TLSSocket.Readable.push (_stream_readable.js:134:10)
code: 'EMESSAGE',
response: '550 5.3.4 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:69000000, 17.43559:0000000048010000000000000800000000000000, 20.521',
responseCode: 550,
command: 'DATA' }
and the output when i change the mail to send not recieve:
Message <[email protected]> envoyer: 250 2.6.0 <[email protected]> Queued mail for delivery
To fix you need to change the FROM email to be your email. Essentially outlook doesn't let you send email from a account you don't own. So take the original user's email and put it in the body of the text then make the FROM to be your email TO your email.
Solution found in the last comment here: https://social.technet.microsoft.com/Forums/exchange/en-US/69426f64-717d-47e0-aa1b-700903ee83cc/520-storedrv-error?forum=exchangesvrsecuremessaginglegacy
This applies to all email clients using smtp-mail.outlook.com to send email. Sometime near the beginning of July, there was a change that disallowed you using a return email address that is not in your list of verified email aliases or connected accounts. In other words, you can't change the "From" field in emails you send to an anonymous email address.
@User1m Thank you for this advice!! This fixed mine immediately as well.
Most helpful comment
To fix you need to change the FROM email to be your email. Essentially outlook doesn't let you send email from a account you don't own. So take the original user's email and put it in the body of the text then make the FROM to be your email TO your email.
Solution found in the last comment here: https://social.technet.microsoft.com/Forums/exchange/en-US/69426f64-717d-47e0-aa1b-700903ee83cc/520-storedrv-error?forum=exchangesvrsecuremessaginglegacy