Localhost Mail

One of the things I find hard in developing a web application is using a library for sending email such as PHPMailer. I find it hard when used to send emails. Another thing I find hard is when sending emails in a localhost webserver. It would also cost me more and would take much time in setting up my own mail server. PHP’s mail function is also very useless in such testing ground.

If you are using a gmail account and want to use PHP’s mail function in your local webserver, here is a better way to relay an email to gmail. I am using backtrack 5 Gnome and the steps will also work for debian based distros. Follow the steps below,

Install ssmtp,

$ sudo apt-get update && apt-get install ssmtp

After installing ssmtp, open the configuration file.

$ sudo nano /etc/ssmtp/ssmtp.conf

Below is an example configuration to have it working, compare your existing configuration to what I have below and apply the changes

After the changes, you can now use PHP’s mail function