设置大型电子邮件通知系统有哪些方法?
我的公司有一个用 PHP 构建的网站。我们使用内置的 PHP 电子邮件功能每天向订阅者发送数千封电子邮件。
这是一个糟糕的主意。它堵塞了我们的服务器,并且需要几个小时才能完成整个批次。
现在我已经研究过像 MailChimp 这样的群发邮件服务(它将取代我们当前向许多人发送相同电子邮件的系统),但我认为我真正想做的是建立一个稍微复杂的通知系统。
我希望客户能够自定义他们收到的电子邮件的速率和内容,而不是每次发生重要事件时向每个人发送大量电子邮件。
即使使用这个新想法,我们也会发送大量电子邮件。
所以我的问题非常具体:我大致了解如何在内部构建系统,但是发送所有这些电子邮件的最佳方式是什么?
需要考虑的要点:
- 有时,收件人的电子邮件内容是相同的,但其中许多内容将根据用户进行定制(他们选择收到通知的内容,有时会进行汇总)。
- 我想要一个不会阻塞服务器并且会在相当长的时间内完成的系统。如果需要的话,我不介意使用第三方服务(甚至是付费服务)。
- 该系统应该很容易连接到 PHP,或者 API 或其他任何东西应该相对容易从典型的 Web 服务器调用。
- 我们有一个专用服务器并对其进行完全控制(因此我们可以安装应用程序、服务等)。
- 任何类型的详细跟踪信息(打开、点击等)都是一个巨大的优势。
- 这些电子邮件有时具有时间敏感性(因此不能花一整天的时间来发送)。
想法?尖端?给我指明正确的方向吗?
编辑
澄清一下:
我可以自己做这些:
- 维护用户列表
- 根据用户偏好处理电子邮件内容生成
并且需要其他东西(应用程序,第三方服务,w/e)来:
- 接受电子邮件内容和地址以及实际发送的电子邮件
- 提供跟踪数据(打开、点击等)。越详细越好。
我倾向于第三方服务,因为我不确定任何应用程序都可以避免在发送数千封电子邮件时阻塞服务器(尽管我不认为自己是电子邮件专家,所以我可能是错的)。
My company has a website built with PHP. We use the built-in PHP email functionality to send thousands of emails to subscribers on a daily basis.
This is a terrible idea. It chokes out our server, and takes hours to complete the whole batch.
Now I've looked at mass mailing services like MailChimp (which would replace our current system of sending the same email to many people), but what I think I'd really like to do is to set up a somewhat-sophisticated notification system.
Rather than send a mass email to each person each time something important happens, I'd like clients to be able to customize the rate and content of the emails that they receive.
Even using this new idea, we're talking about A LOT of emails being sent.
So my question is very specific: I have a rough idea of how to build the system internally, but what is the best way to send out all of these emails?
Bullet points to consider:
- Sometimes emails' contents are identical across recipients, but many of them will be customized per-user (they choose what they get notified about, and sometimes it is aggregated).
- I want a system that is not going to choke the server, and will complete in a decent amount of time. I don't mind going with a third-party service (even a paid one) if that is what it is going to take.
- The system should hook into PHP easily, or the API or whatever should be relatively easy for me to call from your typical web server.
- We have a dedicated server and full control over it (so we can install apps, services, whatever).
- Any kind of detailed tracking information (opens, clicks, etc) is a huge plus.
- These emails are sometimes time-sensitive (so can't take all day to send).
Thoughts? Tips? Point me in the right direction?
EDIT
To clarify:
I can do these on my own:
- maintain user list
- handle email content generation based on user preferences
And need something else (app, third-party service, w/e) to:
- accept email content and addresses and actually send the emails out
- provide tracking data (opens, clicks, etc). The more detail the better.
I'm leaning towards a third-party service, since I'm not sure any app can avoid choking the server when sending thousands of emails (though I wouldn't consider myself an email expert so I could be wrong).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
为什么您认为您的问题与内置的 PHP 电子邮件功能有关?它是“邮件”的一个非常薄的包装器或一个简单的 SMTP 客户端,具体取决于您运行的平台。
当你说它阻塞你的服务器时 - 你是指你的电子邮件服务器吗?你的网络服务器?还有别的东西吗?
这里没有足够的信息来做出正确的诊断,但看起来问题是你自己造成的 - 当然,有很多人承诺只要你购买他们的最新产品/服务就可以为你解决所有问题。但这很可能无法解决您当前的问题。
您能否告诉我们:
PHP 运行在什么操作系统上
如何调用代码来创建电子邮件
php.ini 文件中的邮件配置是什么
您使用什么类型的 MTA?在什么操作系统上?
你们的 MTA 是如何配置的 - 是直接传送还是通过智能中继传送?
哪个服务器被“阻塞”?
对于外发邮件,您采取了哪些反垃圾邮件措施?
然后告诉我们您做了什么来诊断故障以及为什么您认为它专门针对发送邮件。
C.
Why do you think that your problems are anything to do with the built-in PHP email function? It's a very thin wrapper around 'mail' or a simple SMTP client depending on what platform you are running on.
When you say it chokes your server - do you mean your email server? Your web server? something else?
There's nowhere near enough information here to make a proper diagnosis but it looks like the problems are of your own making - sure, there are lots of people out there who promise to sort all your problems for you if only you buy their latest product/service. But there's a very good chance that this isn't going to solve your current problems.
Can you tell us:
what OS the PHP is running on
how you invoke the code to create the emails
what the mail config in the php.ini file is
what type of MTA are you using? On what OS?
how is youe MTA copnfigured - does it deliver directly or via a smart relay?
which server is getting "choked"?
What anti-spam measures do you have in place for outgoing mail?
Then tell us what you've done to diagnose the fault and why you think its specifically on sending mails.
C.
我建议使用第三方邮件服务 Silverpop 或类似服务。我们已经使用它们几年了并且相当满意。他们已经与主要电子邮件客户端(AOL、Yahoo!、Gmail 等)建立了合作关系,并且可以很好地告诉您您发送的内容是否可能被归类为垃圾邮件。
他们有一个相当广泛的 API,使用可以与现有系统绑定的 XML HTTP/HTTPS 请求。您可以使用它来远程触发电子邮件、安排邮件发送、自定义电子邮件内容、设置、管理和查询大量收件人列表、运行批处理等。
它不是一项完美的服务,但与许多其他服务相比,他们做得很好。到目前为止,我对他们的抱怨很少。
I'd recommend using the third party mailing service Silverpop, or something like it. We've used them for a few years and have been fairly satisfied. They already have relationships with the major email clients (AOL, Yahoo!, Gmail, etc.) and they do a good job of telling you if the stuff you're sending is likely to be classified as SPAM.
They have a fairly extensive API that uses XML HTTP/HTTPS requests that can tie in to existing systems. You can use it to remotely trigger emails, schedule mailings, customize email contents, set up, manage and query huge lists of recipients, run batch processes, etc.
It isn't a perfect service, but compared to a lot of others out there, they do pretty well. I have had very few complaints about them thus far.
我通常通过使用邮件“发送”功能来解决这个问题,该功能将电子邮件转储到队列(数据库表)中,该作业每隔几分钟运行一次,抓取队列中的下一封电子邮件,将其发送出去并将它们标记为成功了。这就是它的简单骨架。然后,您可以在版本 2 中添加对电子邮件失败、退回邮件等的处理。
I usually got around this by having a mail "sending" function that dumped the emails into a queue (database table) with a job that ran every couple of minutes, grabbed the next x emails in the queue, sent those out and marked them as succeeded. That's the simple bones of it. You can then add on handling for email failures, returned mail, etc in version 2.
如果您担心可扩展性和安全性,请使用 Google AppEngine。定制:它提供了一个电子邮件 API,您可以通过 HTTP 接口与它连接任何内容。
当然,这只是一个建议——如果不合适请忽略。
Use Google AppEngine if you are worried about scalability & customization: it provides an email API and you can interface anything to it provided it is through an HTTP interface.
Of course, this is just a suggestion - disregard if this doesn't fit.
很可能并不理想,但如果您正在考虑大规模传输,可以使用商业解决方案,例如 Port 25 的 PowerMTA 可以设置为有效传输给定文件夹的内容。
因此,您只需使用 PHP 为每封出站电子邮件创建个性化的 MIME 格式的原始数据,并在传输前将这些数据放置在临时目录中。 (我过去编写过这样的系统,您会对 PHP 处理电子邮件的能力感到惊讶,即使是相当复杂的文本和 HTML 电子邮件以及图像作为内联附件等。)一旦您准备好了要进行传输,您可以将文件全部移动到 PowerMTA 受监控的文件夹中,它会负责传输。
根据您的看法,这种解决方案的好处/问题是您需要与 AOL、MSN/Hotmail 等人员建立信任关系,以确保您的邮件服务器不会因用户的行为而被列入黑名单。将电子邮件报告为垃圾邮件。 (也就是说,这可能是任何 DIY 解决方案的一个因素。)
Quite possibly not ideal, but if you're looking at large scale transmission there are commercial solutions such as Port 25's PowerMTA that can be set up to effectively transmit the contents of a given folder.
As such, you'd simply use PHP to create the personalised MIME formatted raw data for each outbound email and place these in a temporary directory prior to transmission. (I've written such a system in the past and you'd be surprised at the PHP's ability to grind out the emails, even with quite complex text & HTML emails with images as inline-attachments, etc.) Once you were ready to transmit, you'd then move the files en-masse to the PowerMTA monitored folder and it would take care of the transmission.
Depending on how you look at it the benefit/problem with such a solution is that you'll need to build trust relationships with people such as AOL, MSN/Hotmail, etc. to ensure that your mail server isn't blacklisted due to user's reporting email as SPAM. (That said, this will likely be a factor with any DIY solution.)
为什么不保留您的 PHP 系统并使用第三方 SMTP 服务呢?一些可靠的公司以合理的价格提供仅用于发送电子邮件的机器,例如 Dewahost我正打算使用。
另请参阅问题第三方电子邮件发件人以及我的回答。
Why not keep your PHP system and use a third party SMTP service? Some reliable companies offer the use of e-mailing-only machines at reasonable prices, e.g. Dewahost who I am planning to use.
Also see the question Third Party Email Senders and my answer there.
查看Campaign Enterprise,了解可能的内部解决方案。
Check out Campaign Enterprise for a possible in-house solution.
我的一位朋友使用 http://www.tailoredmail.com 但我个人没有使用过它
One of my friend uses http://www.tailoredmail.com but i havn't used it personally
我知道这是一个较旧的问题,但我只是想建议 SendGrid 这本质上是一个“电子邮件服务器即服务”允许您按每封电子邮件的费用发送电子邮件。
I know this is an older question, but I just wanted to suggest SendGrid which is essentially an "Email Server as a Service" allowing you to send emails with cost per email.