When I had to send activation emails to the users after the users registered I had considered the same SMTP route but even if you manage to get it going there are certain disadvantages using SMTP
- Delay in sending out emails.
- Emails considered spam
- Config etc.
Try this out, it has been very cheap and reliable service for me so far. www.postmarkapp.com
They have APIs that you can hook into using PHP. My sample PHP code that is in Production is as below.
// Create a "server" in your "rack", then copy it's API key
define('POSTMARKAPP_API_KEY', 'xyz-blah-blah-blah');
// Create a "Sender signature", then use the "From Email" here.
// POSTMARKAPP_MAIL_FROM_NAME is optional, and can be overridden
// with Mail_Postmark::fromName()
define('POSTMARKAPP_MAIL_FROM_ADDRESS', 'email address that you are sending from-google apps email in my case');
define('POSTMARKAPP_MAIL_FROM_NAME', 'Description of the Sender name');
// Create a message and send it
Mail_Postmark::compose()
->addTo($to, $to)
->subject('whatever subject you want to put here for your email')
->messagePlain($pin_message)
->send();
Yes its that easy once you have created a virtual server with postmarkapp. Guess what first 1000 emails are free so you can try it out and if not use SMTP your way. After the first 1000 i think 5000 costs $7 or something. Really nice and cheap and I have had no downtime at all.
Try it out. You will like it. By the way I am not associated with postmark in any way its just that I like using their services. Check out my question when I was working on this before.
PHP mail() function sends the email but it takes more than 10 mins to show up