Is it possible to send an email from PHP without using the SMTP server
I need to send a newsletter to several thousands of subscribers with PHP. The hosting service I am using allows me to sen开发者_StackOverflowd 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?
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
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.
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
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.
精彩评论