When developing Web-based applications many times one has to test it and see it is working before going further.
Very often emails need to be send from within those applications.
Here are the steps to easily setup a mail server on the local computer and test email sending.
Environment : Windows XP Pro, IIS 5.1, Cold Fusion 6.1;
- Go to the IIS console in Administrative Tools, expand the SMTP Default Virtual Server, set the domain = local (your computer_name)
and the folders where the dropped and bad emails are collected : mostly
In the properties of the Virtual Server set the IP to
All Unassigned(if you have dynamic IP) or your computer IP if you
have a static one (i.e.
192.168.1.4), then enable logging options if you want to see if the server is working.
You must then make sure the SMTP service is running (in Services ->start).
- In order to test if the SMTP service is listening on the desired port 25 you can run the command line
where the PID on each port is listed and then check with the Task Manager to see if that PID belongs to
- Open the ColdFusion Server Administrator and log in, under
Server Settingsclick on
there you must enter the IP or domain name of your Mail Server : i.e.
for a static IP of your computer. Also check the box
Verify mail server connectionand this connection is checked
when the form is submitted giving a message if everything is OK.
- In the ColdFusion application you can now input the tag related to email sending
<cfmail from="email@example.com" to="#form.email#" subject="Information">Any text</cfmail>.
Now you can test sending emails from your form in a browser.
If you encounter problems, first check the
Dropfolder in the
C:\Inetpub\mailrootfolder, then you can use the next step to debug :
- For debugging or diagnosing your SMTP connection you can download the SmtpDiag tool from Microsoft and test the DNS, receiver’s
and sender’s mail servers, requests and responses. I have encountered problems with some mail servers that wouldn’t let me connect and
this was explicitly shown in the SmtpDiag tool.