MX Plan - Nodemailer in Javascript with SMTP connection to Email Pro Email - Not Working
... / Nodemailer in Javascript ...
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Frage

Nodemailer in Javascript with SMTP connection to Email Pro Email - Not Working

Von
JoshuaH
Erstellungsdatum 2021-09-25 16:12:17 (edited on 2024-09-04 14:23:41) in MX Plan

Hello there,

I am currently attempting to use Nodemailer in my Express.js server to send emails but it doesn't seem to work for me. I have used the verify function from Nodemailer to check if the connection via SMTP was successful and this is returned from the request:
```
{
"code": "EAUTH",
"response": "535 5.7.1 Authentication failed",
"responseCode": 535,
"command": "AUTH PLAIN"
}
```

Here is the code in Javascript I am using to send an email with Nodemailer with my custom domain:
```js
app.get('/mail/verify', (req, res) => {
var transporter = nodemailer.createTransport({
host: process.env.MAIL_HOST,
port: process.env.MAIL_PORT,
secure: process.env.MAIL_SECURE,
auth: {
user: process.env.MAIL_USER,
pass: process.env.MAIL_PASS
},
tls: {
rejectUnauthorized: false
},
});

transporter.verify((err, success) => {
if (err) {
res.send(err);
} else {
res.send('Server is ready to take our messages!');
}
});
});
```
These are the .env variables I am using:
```.env
MAIL_HOST = 'ssl0.ovh.net'
MAIL_PORT = 465
MAIL_SECURE = true
MAIL_USER = 'example@email.com'
MAIL_PASS = 'password'
```
If I replace 'ssl0.ovh.net' with the server of my Email Pro, I get a ETIMEOUT error. Does anyone know what may be causing this and what I can do to make this work?

Thank you for taking the time to read this and I look forward to any responses!


Antworten sind derzeit für diese Frage deaktiviert.