0

Possible Duplicate:
How to send 100.000 emails weekly?

I'm tweaking a registration system for internal use at a large organization. It needs to send out daily reminders to users who are registered for events each day. This system started out small but now some days there are 300 - 600 people registered for an event.

So far I've been using php's mail function and that has worked fine. However, they are using Google Apps for their e-mail and it would be nice to send from a dedicated account and reference the sent mail folder if we need to look at what was sent out.

My thoughts so far:

  1. I've tested PHPMailer and it works fine with Google Apps but I don't believe it batches e-mails - so I think it would have to open and close the SMTP connection for each e-mail which might be inefficient.

  2. I know I can edit the php.ini file and specify SMTP information to be Google Apps - that might be an option as well - but from what I understand PHP's mail function is not really the best way to send large numbers of e-mails either.

  3. Years ago I looked at PEAR::Mail which I believe does a much better job at sending large numbers of e-mails, but I wasn't sold on it then. Maybe it is the best solution but I was wondering if something more recent or more awesome was out there.

So, are the best ways to send up to a few hundred e-mails each day via G-Mail from PHP?

Community
  • 1
  • 1
cwd
  • 53,018
  • 53
  • 161
  • 198
  • 2
    One word and a half: Don't. See also [How to send 100.000 emails weekly?](http://stackoverflow.com/questions/3905734/how-to-send-100-000-emails-weekly) (in short: with hundreds of bulk e-mail recipients a day, look into outsourcing this, it's much faster, cheaper, and more reliable) – Piskvor left the building Nov 09 '11 at 15:16
  • 3
    as far as I remember, phpmailer does support what you want to do... I dont think that it connects and disconnects when you call the send() method (or it connects only the first time you call it)... try having a look in the source, if this is true, you can then just change the addTo and call send() in a loop or something – Catalin Nov 09 '11 at 15:18
  • @Catalin - I will look into the source - I was hoping that it could handle batching. However when using it for a few e-mails though I did notice quite a long pause while the script was running and that's what made me concerned that it might not work well for a higher volume. But yes, good point, I need to look into the source, and/or find an article that talks about sending bulk mai with it. – cwd Nov 09 '11 at 15:22

2 Answers2

4

You could use SwiftMailer.

Easy to set up for use with Gmails servers. You can do batch send as well.

http://swiftmailer.org/wikidocs/v3/tutorials/batch

I've used it a lot for sending mass emails, it works well.

Flukey
  • 6,445
  • 3
  • 46
  • 71
  • Hmm, I wonder if I don't want a 'batch' e-mail after all. The e-mails I'm sending need to have some personalization (event list specific to the recipient). Is that possible with SwiftMailer in a "batch" fashion? – cwd Nov 09 '11 at 18:38
1

You should really be using your own mail server for mass-mailing of unsolicited mail. Third-party services like gmail may flag your account mailbox and disable it if you're sending too many emails in too short of a period as this is something that spammers do.

But really, you should set up your own SMTP mail server and use a SMTP-based PHP library

  • Depends if you have an enterprise account with google... – Flukey Nov 09 '11 at 15:17
  • 4
    The paid Google Apps increases the max number of outgoing messages you can send daily from 500 to 2000. It also signs the mail and reduces the number of messages that go to spam. That's why I was leaning towards it. – cwd Nov 09 '11 at 15:17