Replies: 2 comments 2 replies
-
You are not using EmailJS, so I am unsure what your question is. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Not related to the EmailJS service |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I wanted to setup EmailJS and i keep getting error as follows :
Error sending email: Error: Invalid login: 535 5.7.3 Authentication unsuccessful [CH0PR04CA0050.namprd04.prod.outlook.com 2024-07-25T06:52:12.382Z 08DCABD98DD48F9D]
at TLSSocket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10) {
code: 'EAUTH',
response: '535 5.7.3 Authentication unsuccessful [CH0PR04CA0050.namprd04.prod.outlook.com 2024-07-25T06:52:12.382Z 08DCABD98DD48F9D]',
responseCode: 535,
command: 'AUTH LOGIN'
in my simple NodeApp. i created .env file and put following values :
and in my server.js file i have following code :
const express = require("express");
const bodyParser = require("body-parser");
const nodemailer = require("nodemailer");
require("dotenv").config();
const app = express();
const port = process.env.PORT || 3000;
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static("public"));
app.post("/send-email", (req, res) => {
const { email, comments } = req.body;
// Log request body for debugging
console.log("Request Body:", req.body);
// Configure nodemailer
const transporter = nodemailer.createTransport({
host: "smtp.office365.com", // Outlook SMTP server
port: 587, // Port for TLS
secure: false, // Use SSL/TLS when true for port 465, false for port 587
auth: {
user: process.env.EMAILJS_USER_ID, // Your Outlook email address
pass: process.env.EMAILJS_PASSWORD, // Your Outlook email password or app-specific password
},
});
const mailOptions = {
from: process.env.EMAILJS_USER_ID,
to: email,
subject: "Feedback Received",
text: comments,
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.error("Error sending email:", error);
return res.status(500).send({ message: "Error sending email", error });
}
res.send({ message: "Email sent successfully", info });
});
});
app.listen(port, () => {
console.log(
Server is running on port ${port}
);});
Please help where am i going wrong
Beta Was this translation helpful? Give feedback.
All reactions