Transport failed to connect to server error while sending mail through ASP webpage

Discussion in 'C#' started by Arahan Sharma, Feb 20, 2009.

  1. #1

    Hi,

    I am getting an error within the intranet application when trying to send a mail below is the error:
    CDO.Message.1 (0x80040213)
    The transport failed to connect to the server.


    I deploy the code on server whose configuration is: ( OS: Win 2003 Server enterprise edition and IIS: 6.0)
    But when using localhost(my system for testing) the mail is being sent successfully, below is the code I am using. Any suggestin to rectify the error will be apprecitated.

    'Code for sending mail

    <%
    Dim myMail
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Error in Application !!!"
    myMail.From="arahan@xyz.com"
    myMail.To="arahan@xyz.com"
    myMail.Bcc="arahan@xyz.com"
    myMail.Cc="arahan@xyz.com"

    myMail.TextBody="This is a message."

    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

    'Name or IP of remote SMTP server
    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
    ="mail.xyz.com"

    'Server port
    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
    =25

    myMail.Configuration.Fields.Update
    myMail.Send
    set myMail=nothing
    %>


    Regards,
    Arahan
     
    Arahan Sharma, Feb 20, 2009 IP
  2. SearchBliss

    SearchBliss Well-Known Member

    Messages:
    1,899
    Likes Received:
    70
    Best Answers:
    2
    Trophy Points:
    195
    Digital Goods:
    1
    #2
    Does the error specify what line in the code it's occurring?
     
    SearchBliss, Feb 21, 2009 IP
  3. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    If your SMTP server is your ISP's, and your web server is not, it may not allow the webserver to send emails. That would explain why it is running locally but not on the server. most ISP's SMTP servers, will only allow there users to send from them (for obvious reasons). Or it may need authentication of some sort.
     
    camjohnson95, Feb 24, 2009 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    maybe try using mail.yourwebserver.com or smtp.yourwebserver.com as the SMTP server.
     
    camjohnson95, Feb 24, 2009 IP