Search code examples
symfonysmtpgmailswiftmailerdigital-ocean

Digital Ocean and GMAIL smtp server give error


I am using Symfony2 on Digital Ocean Ubuntu 12.04.5 LTS (GNU/Linux 3.2.0-24-virtual i686). Everything is working on my localhost, but do not work on Digital Ocean Server, Here is error message when I try to register user in my web with Activation Email enabled :

Connection could not be established with host smtp.gmail.com [Connection timed out #110]
500 Internal Server Error - Swift_TransportException 

and error stacktrace :

    $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options));
    if (false === $this->_stream) {
        throw new Swift_TransportException(
            'Connection could not be established with host '.$this->_params['host'].
            ' ['.$errstr.' #'.$errno.']'
            );

Output from server terminal :

yusuf@xwzxc:~$ telnet smtp.gmail.com 465
Trying 74.125.130.108...
Trying 74.125.130.109...
Trying 2404:6800:4003:c01::6c...
telnet: Unable to connect to remote host: Network is unreachable

any help will be greatly appreciated.

Thanks


Solution

  • In order to curb spam and abuse, some new user accounts at DigitalOcean have their SMTP ports blocked by default. Unfortunately there are sometimes false positives. It sounds like this might have been the case for you. If you open a support ticket, the team would be happy to remove that block for you