How can I send thousands of emails without limits in php?

我是研究僧i 提交于 2019-12-19 09:47:45

问题


I have a website that every morning sends a newsletter.
But it's not a regular newsletter, every email has different content depending on the user account.

Now I use a class called PHPMailer and it work pretty well, it does what I need. But to do that, i authenticate with a Gmail account. Problem is, Gmail, just like any other email service, has its send-daily-limits.
In facts, it just sends the first 2000 emails.

How can I overcome this problem? My service is free and I don't have money to pay any extra service, I only have my (dedicated) server.
(ubuntu 12.04, lamp stack)

Thanks in advance, and sorry for my awful english.


回答1:


If you run your own server and send legitimate emails, there is no practical limit to how many emails you can send. You're not paying per-message fees, and almost all spam filtering is now done by what the users do with their messages - so if they act like you're sending stuff they want (i.e. they read it and don't mark it as spam), you will have no deliverabilty issues.

There's nothing to say that a server sending high volumes of email will necessarily get blacklisted, though it is often regarded as suspicious if a new server suddenly starts sending lots of messages, so it's a good idea to ramp it up slowly, and/or spread your sending across multiple IPs.

I have self-built sites that send high volumes using PHPMailer - sometimes millions per day each - but you may have trouble configuring an off-the-shelf server to do that. PHP is quite capable of sending several hundred messages per second, mostly depending on your templating system.

You do have to be completely paranoid about your config though:

  • Set up strict SPF
  • Sign with DKIM
  • Configure DMARC
  • You can't use BCC for personalised messages
  • Don't send attachments
  • Keep messages small, link to bigger content
  • Make sure your mail server DNS records resolve both ways
  • Make sure you have good bounce handling (difficult in PHP)
  • Use VERP addressing (helps bounce handling)
  • Monitor your mail server queues
  • Deal with any unsubscribes, spam reports or blacklisting immediately
  • Always, always use double-opt-in for new subscriptions
  • Never use bought-in lists

All this stuff is essentially what you're paying for when you use an ESP, and though they will often try to tell you otherwise, there's nothing stopping you from doing it all yourself - as the saying goes, it's free so long as your time has no value!

As others have mentioned, RSS or notifications may allow you to reduce the amount you need to send via email.




回答2:


You can create a script that limits the amount of email sent in a given period of time. For example 20 emails each minute are equals to 1200 email sent in an hour and stay below your service limits. (most shared server also limits email per hour). In this case the "script" should run with a browser page kept open since it send new request at a given time. (look for example at acymailing extension for Joomla Cms)

Another option is cronjobs. How to send emails via cron job usng PHP mysql




回答3:


Configure your server as a mail server so you can send as many mails as you need, without relying on external servers.



来源:https://stackoverflow.com/questions/32475362/how-can-i-send-thousands-of-emails-without-limits-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!