Swiftmailer 不会发送电子邮件,但 SMTP 客户端会
我正在尝试使用 swift_smtptransport 发送一封电子邮件,该电子邮件将连接到 127.0.0.1:25 我正在使用以下代码:
$message = Swift_Message::newInstance();
$message->setSubject('Test mail');
$message->setFrom('admin@localhost');
$message->setTo('peter@localhost');
$message->setBody('Test message');
$num = $this->getMailer()->send($message, $failures);
print_r($failures);
echo $num;
结果是: array() 0 因为什么也没发生,没有例外,没有任何事情。
我正在使用水银电子邮件服务器,日志仅显示:
Connection from 127.0.0.1, Sat Jun 04 23:46:56 2011
EHLO [127.0.0.1]
QUIT
0 sec. elapsed, connection closed Sat Jun 04 23:46:56 2011
但在我尝试使用雷鸟发送电子邮件后,日志显示:
Connection from 127.0.0.1, Sat Jun 04 23:39:20 2011
EHLO [127.0.0.1]
MAIL FROM:<peter@localhost> SIZE=381
RCPT TO:<peter@localhost>
DATA
DATA - 11 lines, 381 bytes.
QUIT
0 sec. elapsed, connection closed Sat Jun 04 23:39:20 2011
I'm trying to send an email using swift_smtptransport that will connect to 127.0.0.1:25 I'm using the following code:
$message = Swift_Message::newInstance();
$message->setSubject('Test mail');
$message->setFrom('admin@localhost');
$message->setTo('peter@localhost');
$message->setBody('Test message');
$num = $this->getMailer()->send($message, $failures);
print_r($failures);
echo $num;
The result is: array() 0 as nothing happend, no exception, no nothing.
I'm using mercury email server and the log says only:
Connection from 127.0.0.1, Sat Jun 04 23:46:56 2011
EHLO [127.0.0.1]
QUIT
0 sec. elapsed, connection closed Sat Jun 04 23:46:56 2011
but after I've tried to send an email with thunderbird the log says:
Connection from 127.0.0.1, Sat Jun 04 23:39:20 2011
EHLO [127.0.0.1]
MAIL FROM:<peter@localhost> SIZE=381
RCPT TO:<peter@localhost>
DATA
DATA - 11 lines, 381 bytes.
QUIT
0 sec. elapsed, connection closed Sat Jun 04 23:39:20 2011
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查开发环境的配置,factory.yml 中的 switfmailer Delivery_strategy 选项设置为 none。
Check configuration for the dev environment, the switfmailer delivery_strategy option is set to none, inside factories.yml.