If you ever needed to write program that sends email, most likely you’ll need a SMTP server. Here’s how you can configure one on a Windows box using hMailServer.
New Domain
After downloading and installing, you need to add a new domain to hMailServer. In my case I will not be using hMailServer to accept incoming email, hence I did not put the company’s email domain. Doing so will cause email to your colleague to be routed locally and likely fails.
So go ahead add a new domain, and just give it the local machine name (eg: devbox01.local). You have to pick a name that resembles an actual domain (with a dot and suffix), otherwise hMailServer will rejects it.
New Account
Once you’ve setup the domain, create a new account
Set a password, and that’s it you’re done. You can now use the SMTP server for outbound email
- Username:
- Password: whatever password you put in
- SMTP host: devbox01
- SMTP port: 25
Important
Now what’s left to do is configuring firewall. If you program runs on the same box you might not need to do anything. However it’s good to check that no outside traffic from internet can connect to port 25 so no-one can abuse your SMTP server.
Tried it, but I have a question, When I ran the diagnostics I received MX record for domain xxxxxx could not be resolved.
Unable to resolve the domain name is what I received. I can understand the reason, but your blog made me think I may work, did this work in your case.
I think your problem is not with the sending SMTP server, but the DNS resolution. Test if you can actually send email into the address from other sources (eg: yahoo / hotmail), if so then something is wrong causing your outbound SMTP host unable to resolve the MX record. Basically if you go to a DNS lookup website (eg: http://www.whois.com.au/whois/dns.html) and put your domain, a valid MX record has to be registered there.