Unable to connect to GMail SMTP server

7,763

Check if your firewall rule(s) allow connection in/out of port 465. If not, try telnetting to another email server to rule out problems with connectivity to gmail in particular (there are many things that could inhibit a connection).

Share:
7,763

Related videos on Youtube

Diego Couto
Author by

Diego Couto

Updated on September 18, 2022

Comments

  • Diego Couto
    Diego Couto over 1 year

    I'd like to send some emails with my gmail account and nodemailer. Locally, it works fine, but not in my server.

    $ telnet smtp.gmail.com 465
    Trying 74.125.29.108...
    Trying 74.125.29.109...
    Trying 2607:f8b0:400d:c04::6d...
    telnet: Unable to connect to remote host: Network is unreachable
    
    $ openssl s_client -connect smtp.gmail.com:465
    connect: Connection timed out
    
    $ nslookup smtp.gmail.com
    Server:     8.8.4.4
    Address:    8.8.4.4#53
    
    Non-authoritative answer:
    smtp.gmail.com  canonical name = gmail-smtp-msa.l.google.com.
    Name:   gmail-smtp-msa.l.google.com
    Address: 74.125.29.108
    Name:   gmail-smtp-msa.l.google.com
    Address: 74.125.29.109
    
    • FooBee
      FooBee about 10 years
      Check if you block the host and/or port locally and ask your provider the same.
    • Michael Hampton
      Michael Hampton about 10 years
      Use port 587 in this scenario.
  • Diego Couto
    Diego Couto about 10 years
    Thanks Peter, with your and @SvW suggestions I contacted DigitalOcean and it seems that they block SMTP connections by default on new accounts.