Setting up XAMPP for email feature development
XAMPP contains a package called Mercury which allows you to set up a local SMTP 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:
- Trying to configure Mercury takes 27 or more steps which can be extremely confusing without a guide. I found 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.
- In order to use Moodle’s email functionality, we need to configure the settings under the Administration Panel → Server → Email.
- Set SMTP hosts: localhost
- Leave SMTP username and SMTP password blank.