如何在PHP中同时发送多个电子邮件 [英] How to send multiple emails at the same time in PHP
本文介绍了如何在PHP中同时发送多个电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我有一个数据库,在我的数据库中我有大约300封电子邮件,但是当我发送时出现此错误:
Hello, I have a database and in my database I have about 300 emails inside but when I am sending I am having this error:
504 Gateway Time-out
The server didn't respond in time.
我该怎么办?
这是代码:
What should I do ?
Here is the code:
$result = $pdo->query("SELECT * FROM table WHERE week= ".date('W')." ") $count = 1;
while($row = $result->fetch(PDO::FETCH_ASSOC))
{
if (!filter_var($row['Email'], FILTER_VALIDATE_EMAIL) === false)
{
$Fr_Email = $row['Email'];
$title= "xxx - xxx";
$tete.= "From:XXX <xxx@xxx.com>\n";
$tete.= "X-Priority: 1 \n";
$tete.= "MIME-Version: 1.0"."\n";
$tete.= "Content-Transfer-Encoding: 8bit \n";
$tete.= "Content-type: text/html; charset=utf-8"."\n";
$corps= "Body";
mail($Fr_Email, $title, $corps, $tete);
if ($count % 5 == 0) {sleep(5);} $count++;
}
}
我是什么尝试过:
有什么解决办法吗?
What I have tried:
Is there any solution for this ?
推荐答案
结果 =
result =
pdo-> query( SELECT * FROM table WHERE week = .date(' W')。 )
pdo->query("SELECT * FROM table WHERE week= ".date('W')." ")
count = 1 ;
while(
count = 1; while(
这篇关于如何在PHP中同时发送多个电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文