Swift_Mailer thrown Connection Timeout error on server

259 Views Asked by At

My setup for submitting an e-mail is:

$transport = (new \Swift_SmtpTransport(
    'smtp.gmail.com',
    465,
    'ssl'
))
    ->setUsername(*username*)
    ->setPassword(*password*)
    ->setTimeout(12);

$mailer = new \Swift_Mailer($transport);

Testing this configuration in XAMPP works very well, but when I try to use the same configuration on a server I receive: Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out).

On the server ConfigServer Security & Firewall have:

  • SMTP_BLOCK = Off

What configuration is missing, to Swift_Mailer sending emails without error?

0

There are 0 best solutions below