Welcome to my ASP Code Website

Mail Queue Problems - Pickup and Badmail



If you're working with mail and ASP, it's likely that you will run into problems with the SMTP queues. Here is help in troubleshooting the issues.

First, be sure to read about Sending ASP Mail to learn how to start the operation rolling. This allows you to specify a to, from, subject and text, and then hand the message off to your SMTP server. But where does the message go from there?

If you log onto your server (assuming you have full access to it, which hopefully you do!) you will be able to launch the IIS manager and look at the settings for your website and your mail. The SMTP service will be right there in the tree alongside your website. Normally mail sends and receives from port 25 on your server. So you can in fact TELNET into your mail system by typing

TELNET XXX.XXX.XXX.XXX 25

where the XXXXX part is your server's IP address. Then you can give commands such as HELO to the mail server, to interact with it.

When the SMTP server receives a mail message, it begins in the PICKUP directory. Usually this is c:\inetpub\mailroot\pickup on your hard drive. The SMTP processor then works on it. If you have logging on, you can see a log entry for each mail message generated. If the message is fine, off it goes. If it has an issue, it ends up in the BADMAIL directory. You can then literally open up the mail message in notepad and look at it, to see why it failed.

Normally failures involve truly invalid addresses, but there are other reasons that messages can fail. One is that your mail system is corrupted - a reinstall of SMTP will fix this. Another is that you don't have reverse DNS set up. Many mail systems now reject mail if they cannot find a reverse DNS entry for it, to block spammers. Talk with your hosting company to make sure you have reverse DNS set up.

If you have an issue that sends all of your mail into the BADMAIL directory, once you fix it you can get that mail back through your system again. Just copy all of the BAD files out into the PICKUP directory, and they will be sent through again. Be aware, though, that your mail system automatically generates a "this message could not be sent" message back to YOU if a message can't go out after a certain period of time. So you will be flooded with those "could not be sent" messages once the logjam is released, even though the messages were in fact sent on that second pass.

ASP Mail Code and Troubleshooting