我在做它使用SwiftMail扩展发送控制台应用程序。 由于我们的政策,我有两个虚拟机,其中一个充当SMTP中继,另一个是应用服务器。 通过telnet手动发送邮件到继电器工作正常。 当使用SwiftMail,它的分解。
标题是返回,也没有在返回的条目$failure
变量send()
的响应getHeaders()->toString()
Message-ID: <1351104631.508838778dc03@swift.generated>
Date: Wed, 24 Oct 2012 14:50:31 -0400
Subject: [YourSite] Feedback
From: noreply@localhost.com
To: sixeightzero@localhost.com
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
如果我呼应send()
我得到1
。
boot.php
$app->register(new Silex\Provider\SwiftmailerServiceProvider(), array(
'swiftmailer.options' => array(
'host' => 'ip.host.relay',
'port' => 25,
'encryption' => null,
'auth_mode' => null
),
));
app.php
$message = \Swift_Message::newInstance( )
->setSubject('[YourSite] Feedback')
->setFrom(array('noreply@localhost.com'))
->setTo(array('sixeightzero@localhost.com'))
->setBody("Message!");
$app['mailer']->send($message, $failures);
当我运行的应用程序服务器上的TCP转储和运行脚本,有没有做SMTP连接,并且没有抛出错误。
任何人之前遇到这样的? 我不想使用sendmail或邮件,但SMTP由于我们的应用需求。