Can't send email in droplet with nginx server

October 15, 2019 143 views
DigitalOcean Accounts Nginx

I have a contact form in node js application when user submit a form the email will send to Gmail account.i’m using nodemailer to send emails from this application. this is working completely fine in localhost, but in the live server the does not send and I never see any error message.

  • I’m using droplet with nginx server

Please help me to find the solution

1 Answer

Since a long while, DO is blocking port 25 for email traffic. This, so email servers can’t use your VM as a direct mail relay. You can use port 587 & 465 for mailservers as well.

If this isn’t the case, please post some more information like;

  • Logs
  • Configurations
  • Errors (which you said isn’t there, but there should always be something, somewhere)

Hope this helps you

  • Thanks for the reply. I use port 465, i have found some logs in /var/log/syslog and getting following error message
    Oct 16 03:13:37 rusaidmrddroplet systemd[1]: Started Session 343 of user rusaid.
    Oct 16 03:13:40 rusaidmrddroplet kernel: [942528.046669] [UFW BLOCK] IN=eth0 OUT= MAC=c2:c1:2c:ec:8a:a9:c0:42:d0:39:2c:30:08:00 SRC=185.209.0.92 DST=157.245.115.249 LEN=40 TOS=0x00 PREC=0x00 TTL=244 ID=32914 PROTO=TCP SPT=55288 DPT=3535 WINDOW=1024 RES=0x00 SYN URGP=0

    when i run ufw status

    To Action From


    OpenSSH ALLOW Anywhere
    Nginx Full ALLOW Anywhere
    465 ALLOW Anywhere
    587 ALLOW Anywhere
    25 ALLOW Anywhere
    OpenSSH (v6) ALLOW Anywhere (v6)
    Nginx Full (v6) ALLOW Anywhere (v6)
    465 (v6) ALLOW Anywhere (v6)
    587 (v6) ALLOW Anywhere (v6)
    25 (v6) ALLOW Anywhere (v6)

    465 ALLOW OUT Anywhere
    587 ALLOW OUT Anywhere
    25 ALLOW OUT Anywhere
    465 (v6) ALLOW OUT Anywhere (v6)
    587 (v6) ALLOW OUT Anywhere (v6)
    25 (v6) ALLOW OUT Anywhere (v6)

    if you have any suggestions to check please guide me

Have another answer? Share your knowledge.