# Setting up XAMPP for email feature development

### Overview:

- <span class="caps">XAMPP</span> contains a package called Mercury which allows you to set up a local <span class="caps">SMTP</span> server which can relay messages to external servers such as Gmail. This is useful if you want to test the mailing features of moodle on your local machine.

### What you need:

- <span class="caps">XAMPP</span> which can be found [here](http://www.apachefriends.org/en/xampp.html "http://www.apachefriends.org/en/xampp.html")
- Details for your <span class="caps">SMTP</span> server. I used Gmail which has information posted here:
- [http://mail.google.com/support/bin/answer.py?hl=en&amp;answer=13287](http://mail.google.com/support/bin/answer.py?hl=en&answer=13287)

### Configuring Mercury:

- Trying to configure Mercury takes 27 or more steps which can be extremely confusing without a guide. I found [this guide](http://www.danieltmurphy.com/setting-up-mercury-smtp/ "this guide") to be very helpful.

- In addition to what the guide says you must add the line “sendmail\_from = postmaster@localhost” to both ‘xampp/php/php.ini’ and ‘xampp/apache/bin/php.ini’ before restarting apache and mercury from the xampp control panel.

- If you’re successful, you should be able to use PHP’s mail function without error.

### Configuring Moodle:

- In order to use Moodle’s email functionality, we need to configure the settings under the Administration Panel → Server → Email.

- Set <span class="caps">SMTP</span> hosts: localhost
- Leave <span class="caps">SMTP</span> username and <span class="caps">SMTP</span> password blank.