Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIS SMTP Virtual Server Email Question

Status
Not open for further replies.

MrPink1138

Programmer
Jul 10, 2003
34
US
I have a Win2k server with the IIS SMTP Virtual Server turned on. I've been using it for ages to send emails from contact forms and whatnot with ASP pages.
Now I'm making the switch to ASP.NET and want to do the same. However, when I try to send an email from a .net page I get the following error.

----------
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.
----------

I've tried specifying the IP of the SMTP server, I'm tried not. I've added the IP of the server into the relay restriction box as other postings have suggested but to no avail. Nothing I've done seems to get rid of this error. Regular ASP pages still function fine.

Has anyone had/fixed this problem? Any help would be appreciated.
Thanks
 
I have a habit of posting messages to forums and then finding the answer myself. So I'll post my solution here in case others have the same problem.

I tried specifying the IP address of the SMTP server
I tried specifying the server machine name
I tried specifying Localhost and 127.0.0.1
I tried commenting out the SMTPServer line.
NONE of those worked.

The key is to leave the SMTPServer line in but leave it blank. I.e. - SmtpMail.SmtpServer = ""

Adding the blank string there fixed the problem and everything works like a charm now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top