The transport failed to connect to the server

Hello everyone

I’m having problems trying to send email form my computer. I’m trying to run the sample code (which seems to work for everyone else :confused: ) from:

I’ve also set up IIS to receive email using the following method:

  1. Open IIS control panel
  2. Right-click Default SMTP Virtual Server and choose Properties
  3. Select the Access tab
  4. Select Relay
  5. Click the Add button
  6. Add the localhost IP address:
  7. Uncheck the Allow all computers checkbox.

Well when I run the code on my browser and then click the send button I get the following:

Server Error in ‘/’ Application.

The transport failed to connect to the server.
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.

Source Error:

Line 19: objMail.BodyFormat = MailFormat.Text
Line 20: SmtpMail.SmtpServer = ""
Line 21: SmtpMail.Send(objMail)
Line 22: Else
Line 23: lblResponse.Text = “Please enter an email address.”

Source File: c:\inetpub\wwwroot\caitriona\sendmail.aspx Line: 21

Stack Trace:

[COMException (0x80040213): The transport failed to connect to the server.

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object args, Boolean byrefModifiers, Int32 culture, String namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object args, ParameterModifier modifiers, CultureInfo culture, String namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object args) +58

[HttpException (0x80004005): Could not access ‘CDO.Message’ object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object args) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1861
System.Web.Mail.SmtpMail.Send(MailMessage message) +153
ASP.sendMail_aspx.btn_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\caitriona\sendmail.aspx:21
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +108
System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

any help would be very much appreciated.

Thank you

your computer is not an internet host from what i cant see, so i dont think it woudl be able to send mails to the internet from IIS

But could from your email client.

Difference. A client can send, because your computer is a client. But not an internet host

Thank you so much for this! I do need to investivate this further and will probably post again.