I am building a PHP web application and I need to be able to send emails from my website. The webhost that I’m using (Dreamhost) requires SMTP authentication to send emails, so I can’t use the standard mail() function. I was looking at the PEAR package a little bit, but wouldn’t that need to be installed on my webhost’s server to be used? Is there a relatively simple solution that doesn’t require installing entire packages and programs to get the job done?
Next: Need Help With Transfer A Domain?
Previous: Does Godaddy Business Registration Really Work Or Help In Anyway ? How Does It Work?
"Smtp Authentication With Php?" was posted on Thursday, July 9th, 2009 at 3:37 am.
3 Responses to “Smtp Authentication With Php?”
Leave a Reply
It’s odd that you’re getting that message. I use Dreamhost as well and use the standard mail() function on several sites without authentication or error.
EDIT: Added the link to the Dreamhost wiki on php mail(). Doesn’t mention anything about requiring authentication and saw many posts on the Dreamhost forum saying the same.
SMTP authentication isn’t exactly the simplest thing in the world to accomplish, so you may be better off integrating a third-party package. While PEAR may be an overkill, you might want to take a look at phpMailer instead: http://phpmailer.sf.net/
__________
I’m surprised Dreamhost would require Web host customers to do SMTP authentication in their Web applications; this is a function handled much better by the Dreamhost SMTP servers themselves, which can work from a dedicated DNS cache, and locally cached blacklists/whitelists or . That’s easier for you, the Web hosting customer, and a lot more efficient for them, in terms of bandwidth and running block lists.
Are you sure they are telling you, that you have to do the authentication, or just informing you that if you use their SMTP servers, your outgoing mail addresses must authenticate to be sent?
Edit:
OK, I see from the following that they are wanting your account name/password to authenticate to their SMTP servers to send. You can just script that as part of a custom mail function you call, formatting messages to and from their SMTP hosts. The second link below has example php code using PEAR that does that. PEAR is available on Dreamhost servers, according to the (unofficial) third link, at least through PHP5.