2013-03-26 54 views
2

我试图使用山魈标准Swiftmail SMTP连接,它位于:SwiftMail SMTP错误

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

我得到一个:

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 

任何想法,为什么?

回答

4

这表明你没有连接到山魈服务器,通常指的托管服务提供商阻止出站SMTP访问,或者你正在使用的端口。您可以尝试切换端口(Mandrill支持25,587和2525不加密或STARTTLS,端口465使用SSL),或联系托管服务提供商以查看他们是否可以打开您用于访问Mandrill的端口。

0

有同样的问题,我产生一个新的API密钥,它工作得很好这一点。

0

今天我得到了同样的问题。发现这个问题,但由于缺乏答案,我正在写我如何解决它(我认为你是在Linux下,因为我)。

显然的问题是,没有安装的邮件服务器。所以你必须找到你选择的服务器并安装它。我用postfix并按照以下方式安装它:

sudo apt-get install postfix 

这解决了这个问题。

1

最有可能的,你的凭据是错误的。请重新检查您的API密码作为密码,并确保您使用正确的端口访问smtp服务器。

此外,如果您在使用Symfony2的swiftmailer,确保你提供如下的默认设置:

在app/config.yml:

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

此外,为提供值在参数配置/ _dev.yml:

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

不要浪费你的时间和尝试配置其他SMTP服务器(如Gmail,mandrillapp等)来处理您的外发电子邮件Ø n共享服务器。 GoDaddy,Hostgator等...已经阻止了这个选项。我发现离开“本地主机”作为主机,摆脱用户名和密码就像一个魅力!看起来很简单,但它是真的。

+0

确认 - 这个答案的作品。这对我来说就像一个魅力 - 网站托管在Go爸爸。 – user3158649 2016-01-26 05:19:54

+0

它工作!我们如何配置我们的GoDaddy共享主机使用mailtrap或mailgun发送邮件? – Jnanaranjan 2018-02-07 03:36:52

0

对于GoDaddy的共享服务器,它为我工作。

'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,