Report this

What is the reason for this report?

Very slow smtp.gmail.com connection

Posted on January 14, 2015

I am trying to figure out why my Gmail PHPMailer sends are soooo slow (more than a minute for a tiny email). I tried the following:

telnet smtp.gmail.com 587

…I get a message saying that the server is (I added the etc’s)

Trying 2607:f8b0:etc:etc::6c…"

Then, 4 minutes later, this output appeared:

Trying 64.233.etc.etc Connected to smtp.gmail.com Escape character is ‘^]’. 220 mx.google.com etc…

I believe that I have everything configured to send mail. I do receive the emails, but not for several minutes.

Can anyone shed some light on this situation? Could this be why PHPMailer is so slow? Thanks!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

It appears to be because of IPV6

ben@rweb1:~/smtptest$ time telnet smtp.gmail.com 587 Trying 2a00:1450:400c:c06::6d…

fails

ben@rweb1:~/smtptest$ telnet 64.233.184.108 587 Trying 64.233.184.108… Connected to 64.233.184.108. Escape character is ‘^]’. 220 smtp.gmail.com ESMTP y145sm13837556wmc.17 - gsmtp

does not

i am trying to connect to the port 465 through smtplib in python but I m unable to do so and it remains in hung state : import smtplib settings = {‘username’: u’STCSMTP\n’, ‘use_tls’: False, ‘host’: u’smtp.gmail.com’, ‘sender’: u’STCSMTP@gmail.com\n’, ‘use_ssl’: True, ‘password’: u’STCSupport123’, ‘port’: 465} host = settings[‘host’].strip() s = smtplib.SMTP_SSL(host, settings.get(‘port’, 465))

It looks like you’re timing out on IPv6 connections which is why it’s taking so long.

If you have netfilter rules for IPv6 you may want to consider revising them, or if it’s DO blocking you you will want to contact support.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.