I tried setting up an SMTP server today so that I could send emails directly from my web server using PHP’s mail() function. I tried the free Mercury SMTP server and a couple others and spent a few hours setting them up. But no matter what I tried, I couldn’t get the server to send out emails. After googling for the problem, it looks like ATT/SBC/Yahoo DSL might be blocking connections on port 25 (SMTP) – to prevent spam. Crud.
Anyway, I found a better alternative for Gmail users: PHP Mailer. It provides a class to replace PHP’s mail() function which provides vastly more functionality, the most useful of which is authenticated SMTP connections. This means that you can use Gmail to act as your SMTP server to relay your emails!
Just follow the directions on the website. In the ZIP file, you will find an example file that shows you how to use PHP Mailer with Gmail.