Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Sending Email (Error: Missing credentials for "PLAIN") #1651

Open
Msuf123 opened this issue May 3, 2024 · 0 comments
Open

Not Sending Email (Error: Missing credentials for "PLAIN") #1651

Msuf123 opened this issue May 3, 2024 · 0 comments

Comments

@Msuf123
Copy link

Msuf123 commented May 3, 2024

I am trying to send a email but its showing me a error this is my code
import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({
service: "gmail",
host: "smtp.gmail.com",
port: 587,
secure: false,
auth: {
user: process.env.emailForNodemailer,
pass: process.env.passwordForNodeMailer
}
});

var mailOptions = {
from: 'xrobo17@gmail.com',
to: 'akshatmalik18t@gmail.com',
subject: 'Sending Email using Node.js',
text: 'That was easy!'
};

function email() {
transporter.sendMail(mailOptions, function(err, res) {
console.log("Error:", err);
console.log("Response:", res);
});
}

export { email };
Here inside of password i have used my app password form google which is of 16 digit and this is the error
Error: Error: Missing credentials for "PLAIN"
at SMTPConnection._formatError (/home/king/Desktop/http/server/node_modules/nodemailer/lib/smtp-connection/index.js:798:19)
at SMTPConnection.login (/home/king/Desktop/http/server/node_modules/nodemailer/lib/smtp-connection/index.js:452:38)
at /home/king/Desktop/http/server/node_modules/nodemailer/lib/smtp-transport/index.js:272:32
at SMTPConnection. (/home/king/Desktop/http/server/node_modules/nodemailer/lib/smtp-connection/index.js:215:17)
at Object.onceWrapper (node:events:633:28)
at SMTPConnection.emit (node:events:519:28)
at SMTPConnection._actionEHLO (/home/king/Desktop/http/server/node_modules/nodemailer/lib/smtp-connection/index.js:1360:14)
at SMTPConnection._processResponse (/home/king/Desktop/http/server/node_modules/nodemailer/lib/smtp-connection/index.js:982:20)
at SMTPConnection._onData (/home/king/Desktop/http/server/node_modules/nodemailer/lib/smtp-connection/index.js:763:14)
at SMTPConnection._onSocketData (/home/king/Desktop/http/server/node_modules/nodemailer/lib/smtp-connection/index.js:195:44) {
code: 'EAUTH',
command: 'API'
}
here is my .env file email id emailForNodemailer='xrobo17@gmail.com'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant