tags:

views:

118

answers:

4

I need to send a newsletter to several thousands of subscribers with PHP. The hosting service I am using allows me to send 300 mails/hour tops with their SMTP server.

They told me that if I send email with PHP without authenticating or using the SMTP server I won't have any problems with limits.

Is that even possible? Doesn't the mail() function in PHP use SMTP to send mail?

A: 

On unix/linux, mail() is almost always configured to just use the local sendmail facility.

Technically speaking, you're still using SMTP servers, but not at your ISP. Sendmail communicates directly with the SMTP server responsible for incoming mail for each recipient.

While it's possible that your host has sendmail to route all mail through their SMTP server, it's unlikely.

I'd say just use plain old mail() and give it a shot.

timdev
The problem with `mail()` is that it's not very efficient (see the manual page on `mail()`) you will probably need to implement some kind of queue to avoid overloading for several thousand recipients. But - give it a shot and try out. As long as you keep track which operations returned `true` (to avoid duplicates) you should be fine.
Pekka
A: 

The hosting company probably provides you with a SMTP server you can use, and it is that server that probably has the limitation. You can avoid the limitation by using another SMTP server (one that they aren't providing.)

All e-mail is traditionally "sent" using SMTP. You would need to configure your machine to use an external server.

http://email.about.com/od/emailprogrammingtips/qt/Configure_PHP_to_Use_a_Remote_SMTP_Server_for_Sending_Mail.htm

Patrick Gryciuk
Just be careful with this: Many spam filters check whether the originating SMTP server also handles incoming mail for the sender address's domain. Your sender address should always match a domain on the server you send from.
Pekka
+2  A: 

The mail() function will use whatever php.ini tells it to use which may be sendmail or may be an external SMTP server.

You have a few different options:

  • If they're not time sensitive, use their SMTP server and throttle yourself;
  • Alternatively, if they are time sensitive, it may make sense to authenticate against your own external SMTP server;
  • Finally, I'd suggest looking at a system like MailChimp or iContact. They'll let you send to anyone on your list and will handle bounces and unsubscribes for you. Even better, their servers have been whitelisted by ISPs, etc, so you're much less likely to have your messages flagged as spam.

My 0.02

CaseySoftware
A: 

For a good general discussion of successfully sending e-mails from code, see this Coding Horror post. I noticed one of the comments mentioned the Postmark app as a paid alternative to using your ISP's SMTP server. I've never used it, so I don't know if it's worth the price.

Don Kirkby