connect ECONNREFUSED AdonisJs Mail - javascript

I just started to use the Adonisjs framework and I try to send an fake email over Mailtrap. The problem is I run always into the Error connect ECONNREFUSED 52.202.164.124:2525.
Env:
MAIL_CONNECTION=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_USERNAME=ebe8f4522c4fcc
MAIL_PASSWORD=0bb7b98785dab1
config/mail.js:
connection: Env.get('MAIL_CONNECTION', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP
|--------------------------------------------------------------------------
|
| Here we define configuration for sending emails via SMTP.
|
*/
smtp: {
driver: 'smtp',
pool: true,
port: 2525,
host: Env.get('MAIL_HOST'),
secure: false,
auth: {
user: Env.get('MAIL_USERNAME'),
pass: Env.get('MAIL_PASSWORD')
},
maxConnections: 5,
maxMessages: 100,
rateLimit: 10
},
Controller:
await Mail.send('authentication.emails.confirm_email', user.toJSON(), message => {
message.to(user.email)
.from('hello#adonisjs.com')
.subject('Please confirm your email address')
})
Adonisjs Error, Code 500
Maybe somebody can help me :)

I changed the port to 25 and it works now.
I still don't know the reason why I couldn't get a connection bevore.
It may be the firewall.

change the value to MAIL_PORT=25

Related

how to implement smtp relay using nodemailer in nodejs

i am trying to implement smtp relay . host is host: "10.50.40.4", and port is 26. I am using node mailer but i dont get any email. It just gives time our error. please help how to implement it in node js .
this is my code.
var transporter = nodemailer.createTransport({
// host: "10.50.40.4",
// port: 26,
// secure: true, // use SSL
host: "10.50.40.4",
port: 26,
logger: true,
auth: {
user: "****",
pass: "***",
},
});```

Using Nodemailer - Email is sent but not recieved

I am using a custom email on a custom domain and trying to send emails to clients. On the node side the response shows the email is sent but can't see it on the reciever's input box.
var transporter = nodemailer.createTransport({
host: 'mail.example.com',
port: '587',
secure: true ,
auth: {
user: "noreply#example.com",
pass: 'password' },
tls: rejectUnauthorized:false ,
}
});
transporter.sendMail(mailOptions,function(error,info){
if (error) return 400;
else {
console.log(info) ;
return 200 ;
}
});
Are you sure this is the code that is able to send messages? There is a { missing in key tls.
And try changing the port to 465 (Though it's deprecated)
found out the issue. idk why, but when I added the optional parameter in transporter: name: "www.domain.com"
it started working.

Error routines:ssl3_get_record:wrong version number in NodeJS

I make sending email with nodemailer library, I am using email office. I already success send email but but it goes to spam email and untrust. can anyone help me?
const mailTransporter = nodemailer.createTransport({
auth: {
user: email_user,
pass: email_pass,
},
host: 'mail.***.co.id',
port: 587,
secure: true,
});

why cant i send emails using nodemailer and nodejs?

I'm trying to send email using node.js and nodemailer but when I'm pressing the submit button its just loading and loading and in the end gives me a "504 Gateway Timeout Error" in the server, and "page is not working" locally.
I'm using the following code:
app.post("/postmail", function (req, res) {
var transporter = nodemailer.createTransport({
host: "smtp.mailtrap.io",
port: 2525,
secure: false,
debug: true,
auth: {
user: "xxx",
password: "xxx",
},
});
var message = {
from: "a#b", // Sender address
to: "b#c", // List of recipients
subject: "Design Your Model S | Tesla", // Subject line
text: "Have the most fun you can in a car. Get your Tesla today!", // Plain text body
};
transporter.sendMail(message, function (err, info) {
if (err) {
console.log(err);
} else {
console.log(info);
res.render("landing");
}
});
});
I must also mention that, I tried multiple smtp servers with multiple ports and configuration.
does someone know what to do?
thanks
cuase all of the smtp providers use tls/ssl for secuirity reasons. try to use secure configuration:
var transporter = nodemailer.createTransport({
host: 'smtp.mailtrap.io',
port: 465,
secure: true,
debug: true,
auth: {
user: 'xxx',
password: 'xxx'
}
});

NodeJS nodemailer - IIS SMTP Virtual Server

I'm trying to use nodemailer (https://www.npmjs.com/package/nodemailer) to send e-mail using a local windows server we have, with an SMTP Virtual Server.
The SMTP Virtual Server works fine, we already use Jmail in Classic ASP, pass it the server name, and email gets sent.
var nodemailer = require('nodemailer');
var options = {
host: 'SERVERNAME'
};
var transporter = nodemailer.createTransport(options);
var email = {
from: 'no-reply#domain.co.uk',
to: 'webmaster#domain.co.uk',
subject: 'hello',
text: 'hello world!'
};
var callback = function(err, info){
if (err) { throw err }
console.log('sent');
}
transporter.sendMail(email, callback);
The error I get back from this is:
Can't send mail - all recipients were rejected: 550 5.7.1 Unable to
relay for webmaster#domain.co.uk
If I update the options object to include auth, like this:
var options = {
host: 'SERVERNAME',
auth: {
user: '...',
pass: '...'
}
};
I get this error:
Invalid login: 504 5.7.4 Unrecognized authentication type
How can I use nodemailer to send e-mail using our IIS SMTP Virtual Server..?
I still don't know why the above doesn't work, pointing nodemailer to our SMTP Virtual Server. However I've worked around it.
Our SMTP Virtual Server is setup to use our Office 365 account, so I've updated my nodemailer code to go to Office 365 direct, rather than via our local server.
var options = {
host: 'SMTP.office365.com',
port: 25,
secure: false,
ignoreTLS: false,
auth: {
user: '...',
pass: '...'
},
tls: {
ciphers: 'SSLv3'
}
}
This works.

Categories

Resources