使用 PHP 发送大量电子邮件 [英] Sending mass email using PHP

查看:60
本文介绍了使用 PHP 发送大量电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写一个音乐博客.管理员每2-3天发布一篇新文章.管理员发布文章后,将立即向大约 5000 名订阅者发送群发电子邮件.

I am currently writing a music blog. The administrator posts a new article every 2-3 days. Once the administrator posts an article, a mass email will be sent to around 5000 subscribers immediately.

实现群发邮件功能的最佳方式是什么?

What is the best way to implement the mass mail feature?

下面的函数有用吗?

function massmail() 
{
  $content = '...';
  foreach ($recipients as $r) {
    $_content = $content . '<img src="http://xxx/trackOpenRate.php?id='.$r.'">';
    mail($r, 'subject', $_content);
  }
}

另一个问题:如果所有 5000 个订阅者都在使用 Yahoo Mail,那么 Yahoo 是否会将其视为 DDOS 攻击并阻止我的 SMTP 服务器的 IP 地址?

Another question: If all 5000 subscribers are using Yahoo Mail, will Yahoo treat it as a DDOS attack and block the IP address of my SMTP server?

推荐答案

首先,使用 PHP 附带的 mail() 函数并不是最佳解决方案.它很容易被标记为垃圾邮件,您需要设置标题以确保您正确发送 HTML 电子邮件.至于代码片段是否会起作用,它会起作用,但我怀疑您是否会在没有 指定额外的标题

First off, using the mail() function that comes with PHP is not an optimal solution. It is easily marked as spammed, and you need to set up header to ensure that you are sending HTML emails correctly. As for whether the code snippet will work, it would, but I doubt you will get HTML code inside it correctly without specifying extra headers

我建议你看看 SwiftMailer,它有 HTML 支持,支持不同的 mime 类型和 SMTP身份验证(不太可能将您的邮件标记为垃圾邮件).

I'll suggest you take a look at SwiftMailer, which has HTML support, support for different mime types and SMTP authentication (which is less likely to mark your mail as spam).

这篇关于使用 PHP 发送大量电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆