Persits Software, Inc. Knowledge Base Articles

Host not found error

Problem Description

When trying to send an email message with AspEmail, the following error is generated:

Host not found.

Solution

This error is usually caused by one of two reasons: an invalid host name/address is specified via the Mail.Host property, or the request fails to go through a firewall.

Invalid Host Address or Port Number

Make sure you are pointing to an existing host name or IP address, and that the server at that address is running SMTP. Contact your system administrator or ISP if necessary. Sometimes, SMTP services are configured to run on a port other than 25 (the default SMTP port). If that is the case, you need to set the Mail.Port property accordingly.

An easy and reliable method to verify that your Host address and port are correct is to use the TELNET application. At your MS DOS prompt, type

c:\> telnet host_name 25

If you see an SMTP greeting, it means the host address and port number are valid.

Also, in some cases using an IP address such as "219.12.58.11" instead of a verbal host name such as "smtp.mycompany.com" helps fix this error.

Firewall Problem

If the machine running IIS and AspEmail is separated from your SMTP host by Microsoft Proxy Server, you may experience problems connecting to the SMTP server. AspEmail would report the error "Host not found" although you as an interactive logged-in user would have no problems connecting to the same SMTP server with your email client software. To resolve the connection problem you must assign NT user credentials to the IIS Admin service using the CREDTOOL command-line utility which can be found in the directory \MSP\Clients\I386 on the Proxy Server machine. Copy this utility to the machine running IIS and execute the following command at your MS DOS prompt (specify your own user credentials):

credtool -w -n inetinfo -c username domain password

This command assigns the credentials of a specified NT user to the executable inetinfo.exe that hosts the IIS Admin service. Once this is done, you need to configure your IIS to recognize the credentials. Create the file Wspcfg.ini and place it in the directory where inetinfo.exe is located (usually, it is c:\winnt\system32\inetsrv). Put the following text in the Wspcfg.ini file:

[Inetinfo]
ForceCredentials=1

After that, restart IIS by executing the commands:

net stop iisadmin /y
net start w3svc