Take the 2-minute tour ×

I am trying to send mail via mandrill app using swift mailer. This is my code:

$transport = Swift_SmtpTransport::newInstance('smtp.mandrillapp.com',587);

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

// Create the message
$message = Swift_Message::newInstance()

    // Give the message a subject
    ->setSubject('New Order '.$reservationNumber)

    // Set the From address with an associative array
    ->setFrom(array('noreply@domain.com' => 'domain.com'))

    // Set the To addresses with an associative array

    // Give it a body


Credentials are 100% good. And i get timeout error: Connection could not be established with host smtp.mandrillapp.com [Connection timed out #110].

It looks like something is blocking connection. Maybe this is issue with server configurations? We are using WHM software on our centos server

share|improve this question

1 Answer 1

I've just been doing battle with exactly the same problem, but with smtp.gmail.com. It just would not work, even though the username/password etc were all correct.

In my case it seems that when PHP tries to connect to smtp.gmail.com, it gets the IPv6 address back - but their server seems to not be listening on that, since the Swiftmailer responds with the same timeout error you get.

But when I swapped in its IPv4 address (got by ping-ing it), it connected and sent the email just fine.

So find out what smtp.mandrillapp.com's IPv4 address is and try that IP in place of the hostname in the code. Does that connect and send now? It did for me.

It's not ideal coding in an IP address - given that they could change it at any minute - but at least you will get some emails sent

share|improve this answer

Your Answer


