Setting up email functionality on WAMP with Gmail account

If you need to send emails from your WAMP server or to test application’s email functionality, there is an easy way to set this up on your Windows machine ( make sure you have gmail account to use for this ). These are necessary steps:

1) Download ‘fake sendmail for windows’ program from here http://glob.com.au/sendmail , extract the package and copy ‘sendmail’ folder where you want ( good idea would be folder like C:\wamp\ , so sendmail is located at C:\wamp\sendmail )

2) Open C:\wamp\sendmail\sendmail.ini and edit following lines:

smtp_server=smtp.gmail.com
smtp_port=465
auth_username=user@gmail.com
auth_password=your_password

where user@gmail.com is your gmail and your_password password for this gmail account.

3) In php.ini ( for wamp path it’s usually something like this C:\wamp\bin\apache\Apache2.4.4\bin ) edit sendmail_path to match location of sendmail.exe like this:

sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"

Save changes, restart Apache and you should be able to use mail() function without problems.

Note: With this setup you will need to specify From header when using mail() function. If you want to have default From field edit force_sender= in sendmail.ini to match default From email address to be used