Jump to content

ASP v1.1 mailer error: 'failed to connect to server', only sometimes..


Recommended Posts

Guest Brock Hensley
Posted

A client has setup a simple test.aspx mail script, he reports that it works

sometimes, othertimes he receives the error below. What could cause the

script to work sometimes but not others? No bounce back messages, just 'The

transport failed to connect to the server'

 

Script:

----------------------------------------

Here's the code behind for the test.aspx:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

SendEmail(to@hisdomain.com, "info@fromdomain.com", "subject", "body",

Mail.MailFormat.Html, Mail.MailPriority.Normal)

End Sub

 

Private Sub SendEmail(ByVal TO_ADDRESS As String, ByVal FROM_ADDRESS As

String, ByVal SUBJECT As String, ByVal BODY As String, ByVal BODY_FORMAT As

System.Web.Mail.MailFormat, ByVal PRIORITY As System.Web.Mail.MailPriority,

Optional ByVal CC_ADDRESS As String = "", Optional ByVal BCC_ADDRESS As

String = "")

'Send an email via the framework

'Required params are passed into this sub

Dim objMail As New System.Web.Mail.MailMessage

objMail.To = TO_ADDRESS

objMail.Cc = CC_ADDRESS

objMail.Bcc = BCC_ADDRESS

objMail.From = FROM_ADDRESS

objMail.BodyFormat = BODY_FORMAT

objMail.Priority = PRIORITY

objMail.Subject = SUBJECT

objMail.Body = BODY

System.Web.Mail.SmtpMail.SmtpServer =

ConfigurationSettings.AppSettings("SMTP_IP_ADDRESS")

System.Web.Mail.SmtpMail.Send(objMail)

End Sub

 

----------------------------------------

 

 

 

Error:

----------------------------------------

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:

 

An unhandled exception was generated during the execution of the

current web request. Information regarding the origin and location of the

exception can be identified using the exception stack trace below.

 

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) +1569

System.Web.Mail.SmtpMail.Send(MailMessage message) +153

emaxEPAct.test.SendEmail(String TO_ADDRESS, String FROM_ADDRESS, String

SUBJECT, String BODY, MailFormat BODY_FORMAT, MailPriority PRIORITY, String

CC_ADDRESS, String BCC_ADDRESS)

emaxEPAct.test.Page_Load(Object sender, EventArgs e)

System.Web.UI.Control.OnLoad(EventArgs e) +67

System.Web.UI.Control.LoadRecursive() +35

System.Web.UI.Page.ProcessRequestMain() +750

 

 

 

--------------------------------------------------------------------------------

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

Version:1.1.4322.2407

 

----------------------------------------

 

 

 

Thanks,

-B

  • Replies 0
  • Created
  • Last Reply

Popular Days


×
×
  • Create New...