【发布时间】:2014-08-17 01:53:14
【问题描述】:
我正在尝试使用 swift mailer 通过 mandrill 应用程序发送邮件。这是我的代码:
$transport = Swift_SmtpTransport::newInstance('smtp.mandrillapp.com',587);
$transport->setUsername($username);
$transport->setPassword($password);
// 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
->setTo('test@domain.com')
// Give it a body
->setBody($body,'text/html');
$mailer->send($message);
凭据是 100% 好的。我收到超时错误:无法与主机 smtp.mandrillapp.com 建立连接 [连接超时 #110]。
好像有什么东西阻塞了连接。也许这是服务器配置的问题?我们在 centos 服务器上使用 WHM 软件
【问题讨论】:
标签: php email smtp centos swiftmailer