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;
Steps :
- 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 : mostlyC:\Inetpub\mailroot\DroporBadmail
folder;
In the properties of the Virtual Server set the IP toAll 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
netstat -ano,
where the PID on each port is listed and then check with the Task Manager to see if that PID belongs toinetinfo.exe(IIS). - Open the ColdFusion Server Administrator and log in, under
Server Settingsclick onMail,
there you must enter the IP or domain name of your Mail Server : i.e.mail.mydomain.comor192.168.1.4
for a static IP of your computer. Also check the boxVerify 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="office@company.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 theBadmailandDropfolder in theC:\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.
Thanks for the info, I am sure this will help us all when developing.
Pls. visit my friends:
Sentra – Sentra
Thanks for this, just in case someone else has difficulty. I had to enable relaying for it to work for me. To do this:
1. Right click on ‘Default SMTP Virtual Server’ in IIS admin, select Properties.
2. Click Access tab, then ‘Relay…’
3. Switch radio button to ‘All except the list below’
This should get it working, I used 127.0.0.1 as my mail server address in CF Admin.
To debug watch the /Spool /Undelivr directories in CF, and check the mail.log.
Enjoy.