【发布时间】:2017-05-09 13:51:40
【问题描述】:
我正在使用:
- RHEL 6.6
- Symfony 2.8.18
- PHP 5.5.30
- Apache 2.4.10
- MySQL 5.1.73
当我想发送 5 封或更多电子邮件时,我收到以下两条错误消息(如果我发送 1 或 2 或 4 封电子邮件,它会完美运行...):
注意:fwrite(): 发送 40 字节失败,errno=32 Broken pipe in /appli/projects/APACHE-PHP/apache_2.4/htdocs/APACHE-PHP/project/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php 在第 231 行
注意:fwrite(): 发送 6 个字节失败,errno=32 Broken pipe in /appli/projects/APACHE-PHP/apache_2.4/htdocs/APACHE-PHP/project/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php 在第 231 行
我添加了一个 Try/Catch(通过搜索其他帖子):
foreach($messages as $message){
try{
$this->get('mailer')->send($message);
}catch (Exception $e){
printf("Error: %s\n", $e->getMessage());
$mailer->getTransport()->stop();
sleep(10);
}
}
但是还是不行……
这很奇怪,因为如果我尝试使用 PHP 邮件功能的简单示例,我可以发送超过 5 封电子邮件(例如 12 封电子邮件):
<?php
$msg = "Suspendisse vestibulum et lectus eu pellentesque. ";
$headers = "From: mypersonalemail@anyidea.com" . "\r\n" .
"CC: mypersonalemail@anyidea.com";
for($i = 1; $i <= 12; $i++){
mail("recipient@anyidea.com","Test",$msg, $headers);
}
?>
它与 PHP mail() 函数完美配合,但是当我尝试使用 Swiftmailer 时,我可以发送超过 5 封电子邮件...为什么??
有什么建议吗?
【问题讨论】:
标签: php email swiftmailer symfony-2.8 rhel6