Php 快捷邮件SMTP错误
我正在尝试使用Mandrill的标准Swiftmail SMTP连接,该连接位于以下位置: 我得到一个:Php 快捷邮件SMTP错误,php,smtp,swiftmailer,mailchimp,mandrill,Php,Smtp,Swiftmailer,Mailchimp,Mandrill,我正在尝试使用Mandrill的标准Swiftmail SMTP连接,该连接位于以下位置: 我得到一个: 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/
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
知道原因吗?这表示您没有连接到Mandrill服务器,通常意味着主机提供商正在阻止出站SMTP访问或您正在使用的端口。您可以尝试切换端口(Mandrill支持25、587和2525,不使用加密或STARTTLS,端口465使用SSL),或者联系主机提供商,看看他们是否可以打开您用于访问Mandrill的端口。有同样的问题,我生成了一个新的API密钥,它可以正常工作 我今天也遇到了同样的问题。我发现了这个问题,但由于缺乏答案,我正在写我是如何修复它的(我假设你和我一样是在Linux下) 显然,问题是没有安装邮件服务器。因此,您必须找到您选择的服务器并安装它。我使用postfix并以以下方式安装它:
sudo apt-get install postfix
这解决了问题。很可能是您的凭据错误。请重新检查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 }
此外,在parameters/_dev.yml中提供配置值:
mailer_transport: smtp
mailer_host: smtp.mandrillapp.com
mailer_user: [USERNAME]
mailer_password: [APIKEY]
mailer_port: 587
不要浪费时间,尝试配置其他SMTP服务器(Gmail、mandrillapp等)在共享服务器上处理发送的电子邮件。戈达迪、霍斯盖特等。。。已阻止此选项。我发现离开“localhost”作为主机,并摆脱用户名和密码就像一个符咒!看起来太简单了,但这是真的。对于godaddy共享服务器,它适合我
'driver' => 'smtp',
'host' => 'localhost',
'port' => '587',
'from' => array('address' => 'xxx@xxx.com', 'name' =>'This is a Sign up mail' ),
'encryption' => 'tls',
'username' => 'xxxxxxxx',
'password' => 'xxxxxx',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
确认-此答案有效。这对我来说就像一个魅力-网站托管在Go daddy上。它成功了!我们如何配置GoDaddy共享主机以使用mailtrap或mailgun发送电子邮件?