SmtpMail.Send Error

C

Chris Lane

I am getting the following error when trying to send the
mail object:
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)
+1512
System.Web.Mail.SmtpMail.Send(MailMessage message) +49
Forms.AddStore.Page_Error(Object sender, EventArgs e)
in C:\Inetpub\wwwroot\Forms\AddStore.aspx.vb:137
System.Web.UI.TemplateControl.OnError(EventArgs e) +109
System.Web.UI.Page.HandleError(Exception e) +68
System.Web.UI.Page.ProcessRequestMain() +2065
System.Web.UI.Page.ProcessRequest() +118
System.Web.UI.Page.ProcessRequest(HttpContext context)
+18
System.Web.CallHandlerExecutionStep.Execute() +179
System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously) +87

Here is the code I am using:
Dim objMail As New Mail.MailMessage()
Dim objSmtp As Mail.SmtpMail
Dim ErrorMessage As String = "The following errors
occurred: " & ControlChars.CrLf & ex.ToString
objMail.To = "(e-mail address removed)"
objMail.From = "(e-mail address removed)"
objMail.Priority = MailPriority.High
objMail.BodyFormat = MailFormat.Text
objMail.Subject = "Error On AddStore.aspx Page"
objMail.Body = ErrorMessage
objSmtp.SmtpServer = "localhost"
objSmtp.Send(objMail)
objMail = Nothing
objSmtp = Nothing

The only thing I changed in this posting was the email
addresses.
I have also tried not setting the SmtpServer property to
let it use the default.
Not sure what is wrong since I had it working before.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top