我正在使用 php 和 mysql.
I am using php and mysql.
我将发送 10k++(一万多封)电子邮件来更新我的订阅者,这是我第一次发送它们.我将使用php邮件功能,基本上我会这样做:
I am going to send 10k++ (ten thousands plus) emails to update my subscribers, and this is the first time I am going to send them. I will use php mail function, basically here is what I will do:
首先从数据库中获取数据:
First get the data from database:
Select name, email FROM data之后,使用while循环发送数据:
After that, using while loop to send the data:
while($r = mysql_fetch_assoc($exe)){ ... if($mail){ echo "success<br>"; } else { echo "failed<br>"; } } echo "Sent all";我包含了 if.. else 语句,以确保每封电子邮件都成功发送.有什么我需要照顾的吗?发送给 10K++ 用户时我会遇到任何问题吗?
I include the if.. else statement, to ensure that each email is sent successfully. Is there anything I need to take care of? Will I have any problems when SENDING TO 10K++ users?
您要发送的电子邮件数量有限制吗?
Is there a limit of numbers of emails that you are going to sent?
推荐答案请注意 邮件文档中的此注释:
注意:值得注意的是,mail() 函数不适合循环处理大量电子邮件.此函数为每封电子邮件打开和关闭一个 SMTP 套接字,效率不高.如需发送大量电子邮件,请参阅 » PEAR::Mail 和 » PEAR::Mail_Queue 包.
Note: It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient. For the sending of large amounts of email, see the » PEAR::Mail, and » PEAR::Mail_Queue packages.
更多推荐
使用php邮件功能有限制吗?
发布评论