向订阅者发送大量电子邮件的最佳方式(BCC 或 PEAR 邮件队列?)
我需要向我的 5000 名订阅者发送电子邮件。 最好的方法是什么?
1) 通过使用密件抄送 ?:
$from_addr = '[email protected]';
$mailing_list = '[email protected]', '[email protected]', '[email protected];
$message_subject = 'this is a test';
`$headers = array ("From" => $from_addr,
"Bcc" => $mailing_list,
"Subject" => $message_subject);
$smtp = Mail::factory("smtp", array ('host' => "smtp.example.com",
'auth' => true,
'username' => "xxx",
'password' => "xxx"));
$mail = $smtp->send($email, $headers, $message_body);`
。
2)通过使用PEAR邮件队列?
I need to send email to my 5000 subscribers.
What is the best way to do this ?
1) By using BCC ?:
$from_addr = '[email protected]';
$mailing_list = '[email protected]', '[email protected]', '[email protected];
$message_subject = 'this is a test';
`$headers = array ("From" => $from_addr,
"Bcc" => $mailing_list,
"Subject" => $message_subject);
$smtp = Mail::factory("smtp", array ('host' => "smtp.example.com",
'auth' => true,
'username' => "xxx",
'password' => "xxx"));
$mail = $smtp->send($email, $headers, $message_body);`
.
2) by using PEAR mail queue ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还没有使用过 PEAR mail_queue,但使用队列绝对是最佳选择!
不应使用密件抄送,因为您的邮件很容易被 gmail/hotmail 等大型电子邮件提供商标记为垃圾邮件。
在电子邮件标头中包含数千个地址似乎很疯狂。甚至可能有一个限制。此外,某些邮件服务器可能会因为标头过大而拒绝您的邮件。最重要的是,应该发送您的电子邮件的邮件服务器不会对此感到高兴。
I haven't used PEAR mail_queue yet, but using a queue is definitively the way to go!
BCC shouldn't be used because your mails would easily get flagged as Spam by big email providers like gmail/hotmail.
Also having thousands of addresses in an email header seems to be crazy. There may even be a limit. Also some mail servers could refuse your mail because of the over-sized header. On top of that the mail server that is supposed to send your email wouldn't be to happy about it.
使用内置的
mail
功能首先并不是最好的方法。我建议你使用 SwiftMailer 它支持 HTML,支持不同的 mime 类型SMTP 身份验证不太可能将您的邮件标记为垃圾邮件。另外,您可以查看这个 pear 包:
http://pear.php.net/package/Mail_Queue< /a>
Using built-in
mail
function is not the best way in the first place for that. I would suggest you to go for SwiftMailer which has HTML support, support for different mime types and SMTP authentication which is less likely to mark your mail as spam.Also, you can check out this pear package:
http://pear.php.net/package/Mail_Queue