2

I am trying to use the standard Swiftmail SMTP connection for Mandrill, which is located here:

http://help.mandrill.com/entries/21746308-Sending-via-SMTP-in-various-programming-languages

I am getting a:

Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.mandrillapp.com [Connection refused #111]' in /home/content/15/10121515/html/includes/classes/Swift/Transport/StreamBuffer.php:259 Stack trace: #0 /home/content/15/10121515/html/includes/classes/Swift/Transport/StreamBuffer.php(64): Swift_Transport_StreamBuffer->_establishSocketConnection() #1 /home/content/15/10121515/html/includes/classes/Swift/Transport/AbstractSmtpTransport.php(115): Swift_Transport_StreamBuffer->initialize(Array) #2 /home/content/15/10121515/html/includes/classes/Swift/Mailer.php(80): Swift_Transport_AbstractSmtpTransport->start() #3 /home/content/15/10121515/html/includes/mail.php(62): Swift_Mailer->send(Object(Swift_Message), Array) #4 {main} thrown in /home/content/15/10121515/html/includes/classes/Swift/Transport/StreamBuffer.php on line 259

Any ideas why?

6 Answers 6

4

This indicates that you're not connecting to the Mandrill server, and usually means that the hosting provider is blocking outbound SMTP access, or the port that you're using. You can try switching ports (Mandrill supports 25, 587 and 2525 with no encryption or STARTTLS, and port 465 with SSL) or contacting the hosting provider to see if they can open the port you're using for access to Mandrill.

2

Don't waste your time and try to configure other SMTP servers (Gmail, mandrillapp etc) to handle your outgoing emails on a shared server. GoDaddy, Hostgator, etc... have blocked this option. I found that leaving "localhost" as the host and getting rid of the username and password worked like a charm! Seems too simple but it's true.

2
  • Confirmed - this answer works. This worked like a charm for me - website hosted on Go daddy. Jan 26, 2016 at 5:19
  • It worked! How can we configure our GoDaddy shared host to send email using mailtrap or mailgun? Feb 7, 2018 at 3:36
1

Most likely, your credentials are wrong. Please recheck your API key as password and make sure that you use the right port to access smtp server.

Also, if you are using swiftmailer in Symfony2, make sure that you provide the default settings as below:

In app/config.yml:

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    port:      "%mailer_port%"
    #spool:     { type: memory }

In addition, provide values for the configuration in your parameters/_dev.yml:

mailer_transport: smtp
mailer_host: smtp.mandrillapp.com
mailer_user: [USERNAME]
mailer_password: [APIKEY]
mailer_port: 587
0

Had the same problem, I generated a new API key and it worked fine with that.

0

I got the same problem today. Found this question, but due to the lack of answer I am writing how I was able to fix it (I assume that you are under Linux, as I am).

Apparently the problem is that there is no mail server installed. So you have to find the server of your choice and to install it. I used postfix and installed it in the following way:

sudo apt-get install postfix

This solved the problem.

0

For godaddy shared server, it works for me.

'driver' => 'smtp',
'host' => 'localhost',
'port' => '587',
'from' => array('address' => '[email protected]', 'name' =>'This is a Sign up mail' ),
'encryption' => 'tls',
'username' => 'xxxxxxxx',
'password' => 'xxxxxx',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.