The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cant send emails via Gmail SMTP, Timeout error

Discussion in 'E-mail Discussions' started by postcd, Jun 23, 2015.

  1. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    619
    Likes Received:
    6
    Trophy Points:
    18
    Hello,

    i have an professional Wordpress plugin, MailPoet and it can send email via SMTP instead PHP mail.

    When i try to connect gmail i get:

    # telnet smtp.gmail.com 465
    # traceroute 64.233.177.108
    Which Gmail SMTP details i used:
    smtp.gmail.com
    my@gmail.com
    TLS/SSL
    25/465
    all these tried.

    im using CSF and i made sure that 465 and 25 is withing allowed outgoing ports.

    # netstat -tulnp | grep 465
    "php_openssl" appears to be enabled

    Please how to fix it so im allowed to connect external SMTP like Gmail? Can you advice which WHM server config i need to check? cpanel support ticket: 6730293

    Thank you
     
    #1 postcd, Jun 23, 2015
    Last edited: Jun 23, 2015
  2. rackaid

    rackaid Active Member

    Joined:
    Jan 18, 2003
    Messages:
    42
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Jacksonville, FL
    cPanel Access Level:
    DataCenter Provider
    In the error you posted, the port is 443 not 465.

    ssl://smtp.gmail.com:443


    Also note that port 465 is SSL only. Port 25 is plain or may use STARTTLS.

    I think Gmail also supports port 587.
     
  3. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    619
    Likes Received:
    6
    Trophy Points:
    18
    Thanks but it is NOT cause of the problem.
    i tried various ports. it just do not connect as mentioned above
     
    #3 postcd, Jun 23, 2015
    Last edited: Jun 23, 2015
  4. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    619
    Likes Received:
    6
    Trophy Points:
    18
    The cause is probably one of these three things?

    1)
    In Config server firewall configuration, there is section "IPv4 Port Settings" & "IPv6 Port Settings", i think it may be needed to add SMTP ports 25,465,587 into all TCP_OUT UDP_OUT variables in both above mentioned sections.
    Then in same configuration CSF file, find section "SMTP Settings", set "SMTP_BLOCK =" to 0 or whitelist some cpanel users in variable "SMTP_ALLOWUSER ="
    Save config and restart csf, lfd.
    After that when logging via SSH to an cpanel account which i whitelisted (su - cpanelname), i see this:
    but still my .php mailer says: "SMTP Error: Could not authenticate. | SMTP Error: Could not connect to SMTP host."

    2) from WHM, check Home »Server Configuration »Tweak Settings
    - Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak) [?]
    (Enabling this feature will redirect outgoing SMTP connections to the local mail server. root, exim, and mailman are still allowed to make direct connections.)

    3) try to add gmail smtp IP (do command: telnet smtp.gmail.com 465) into config server firewall whitelist and ignore list?
     
    ryborg likes this.
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  6. ryborg

    ryborg Registered

    Joined:
    Sep 28, 2016
    Messages:
    1
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    US
    cPanel Access Level:
    Root Administrator
    I know this thread is old but it really helped me out. In my case, step 2) was the root cause. After updating that in WHM, I also needed to go through some troubleshooting steps to allow less secure apps to send email through my gmail account. This basically got me where I needed to go. Thanks!
     
    cPanelMichael likes this.
Loading...

Share This Page