Ich bin neu in der Programmierung von node.js. Ich verwende das Modul nodemailer zum Senden von E-Mails.
NodeMailer ungültige Anmeldung
const nodemailer = require ('nodemailer'),
credentials=require('./credentials.js');
var mailTransport=nodemailer.createTransport({
service:'Gmail',
auth: {
user : credentials.gmail.user,
pass : credentials.gmail.password,
}
});
function sendMail(mail_id){
mailTransport.sendMail({
from: ' "my name" <[email protected]>',
to : mail_id, //[email protected]
subject : 'Hello',
text: "Hello How do u do ?",
},function(err,info){
if(err){
console.log('Unable to send the mail :'+err.message);
}
else{
console.log('Message response : '+info.response);
}
});
}
exports.sendMail=sendMail;
Das ist mein Programm für E-Mails an andere Benutzer senden. Aber ich bekomme Ungültige Login. Ich habe keine Ahnung, warum das kommt. Ich bin neu bei node.js und serverseitigem Scripting.
Ich verwende meinen Google Mail-Nutzernamen und das Passwort für die Anmeldedaten.
Bitte helfen Sie mir.
Überprüfen Sie, ob das hilft: http://stackoverflow.com/questions/19877246/nodemailer-with-gmail-and-nodejs – Raghavan
@Raghavan Was ist smtpConfig? – rock
smtpConfig ist eine weitere Konfigurationsdatei, ähnlich wie Sie "credentials" in Ihrem Code verwenden. – Raghavan