error while sending a email from asp.net application

Discussion in 'C#' started by kharearch, Oct 25, 2008.

  1. #1
    when I send a email from local server it does not give any error and send successfully. But when I send it through web server it gives following error -


    Send failure: System.Web.HttpException: The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at _Default.Button6_Click(Object sender, EventArgs e)



    Please help me to solve the error. My code is following


    Dim mymessage As New MailMessage()
    mymessage.To = "kharearchana@gmail.com"
    mymessage.From = "kharearchana@gmail.com"
    mymessage.Subject = "test message"
    mymessage.Priority = MailPriority.High
    mymessage.Body = "<b>hello world (of email) . </b>"
    mymessage.BodyFormat = MailFormat.Text
    mymessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
    ' //basic authentication
    mymessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "arc11761")
    '//set your username here
    mymessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "khareco9908#")
    '//set your password here

    Try
    SmtpMail.SmtpServer = "67.43.9.64"

    SmtpMail.Send(mymessage)

    Catch exec As Exception
    Response.Write("Send failure: " + exec.ToString())
    End Try
     
    kharearch, Oct 25, 2008 IP
  2. hansab

    hansab Active Member

    Messages:
    162
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #2
    When something is working on your local server and not on your host, that means some objects /components are missing on your hosting server.

    I advice you to contact your hosting support for this matter.

    Your smtp server might be the problem as well, so try changing it, may be the ip address is not allowed, try different things, it should work.
     
    hansab, Oct 27, 2008 IP