Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

{ [Error: timedout while connecting to smtp server] code: 4, smtp: undefined }

Tags:

node.js

email

I am going to send mail in nodejs. So I have installed emailjs. I have configured the script as the followings.

emailjs = require('emailjs');

var server = emailjs.server.connect({
        user:"my gmail address",
        password:"gmail passs word",
        host:"smtp.gmail.com",
        ssl:true,
        port: 456
      });

 server.send({
          text: "message",
          from:"LLVC <my outlook mail>",
          to:"<my outlook mail>",
          subject:"Subject"
        },
        function (err, message) {
        console.log(err || message);
    });

But I got the errors

{ [Error: timedout while connecting to smtp server] code: 4, smtp: undefined }

I want to fix them. Thanks.

like image 940
Jin Hong Avatar asked Jan 01 '26 06:01

Jin Hong


1 Answers

It's port 465, not 456.

If you tried configuring your SMTP server on port 465 (with SSL) and port 587 (with TLS), but are still having trouble sending mail, try configuring your SMTP to use port 25 (with SSL).

https://support.google.com/mail/answer/78775?hl=en

like image 149
GJKH Avatar answered Jan 04 '26 01:01

GJKH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!