The other day I was looking at how to make a simple mail server work in my windows XAMPP installation. This comes in useful if you’re testing an application that sends confirmation emails to registered users to confirm registration or to send a new password.
When I started I was getting errors like: SMTP server response: 550 Address not known here; and SMTP server response: 553 We do not relay non-local mail, sorry.
After hunting around a little on the interweb I didn’t really find any instructions for dummies like me. So in the end, I just thought it through a little. I first decided what my goal should be:
send an email from a localhost user to a localhost user. I’m not worrying about sending emails to external email addresses, because my web host will handle that – I don’t need a fully functional email server.
So here are the steps I took:
Set up Mercury:
1) Turn on the Mercury email program from the XAMPP control panel (without this on you will get nowhere).
2) Click on the Admin button once Mercury has started to open its admin panel. You’ll be presented with a mass of floating windows – just ignore those.
3) Select Configuration -> Manage local users… from the menu
4) Create new users. Note: just create names with letters and numbers, if you type a name it doesn’t like, it won’t tell you why, it will just refuse to save the user. So I created the usernames: marktest1 and marktest2
That’s Mercury set up, now you just need to test it. To do this you need to add these new users to an email program like Mozilla Thunderbird or Outlook Express. For testing things like this, I use Thunderbird Portable – I just find it convenient to have test emails like this handled seperately from real emails.
Set up Thunderbird:
1) Go to Tools -> Account Settings
2) Click on Add Account
3) Your email address is going to be something like marktest1@localhost Note: the email address isn’t email@example.com
4) Your Incoming server is simply: localhost
5) Click on Outgoing Server (SMTP)
6) Click Add
7) Again the Server name is going to be: localhost
Set up at least two accounts in Thunderbird, so you can test sending yourself an email. Once you can send emails between your two new users, you should be able to send emails from your web applications. Just remember to use @localhost email addresses. You might need to check your email validation procedures accept this style of email address.
Below is a youTube video that goes over the steps I have outlined above.