Asp.net sending Email Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sunnyko
    New Member
    • Aug 2006
    • 4

    Asp.net sending Email Problem

    Hello

    I am using Window Small Business Server and MS Exchange Server act as the SMTP server. I wrote a web application for sending email to others. It works fine in XP, but error appears in the Small Business Server

    Here is the code:
    Public Function sendMail(ByVal mailTo As String, ByVal mailFrom As String, ByVal subject As String, ByVal content As String, ByVal priority As String)
    Dim mail As New MailMessage
    mail.BodyFormat = MailFormat.Text
    mail.To = mailTo
    mail.From = mailFrom
    mail.Subject = subject
    mail.Body = content
    SmtpMail.SmtpSe rver = "127.0.0.1"
    SmtpMail.Send(m ail)
    End Function

    Error Message:
    Could not access 'CDO.Message' object. Exception has been thrown by the target of an invocation. The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available

    Please help
  • jharikrishna
    New Member
    • Aug 2006
    • 15

    #2
    define namesapace for cdo.message object

    i.e System.Web.Mail

    Comment

    • sunnyko
      New Member
      • Aug 2006
      • 4

      #3
      I have done that already.

      "Imports System.Web.Mail "

      Error still occur.....

      Comment

      • msbly12345
        New Member
        • Apr 2007
        • 1

        #4
        please check the two points

        1. check the IP

        2. check the content of your mail body

        if you are using something like
        "this first line of message \n this is the second line"

        then chenge it to

        "this first line of message \r\n this is the second line \r\n"

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          I've found in the past that sometimes vague error messages are thrown like this if the mail server could not authenticate the user credentials.

          Does your email server require email user credentials in order to log in to use the email services?

          If so, I'd try something like:
          Code:
              Dim port as Integer = 25
              Dim emailTitle As String = "Title"
              Dim body as String = "This is the body of my email"
          
              Dim emailMessage As New Net.Mail.MailMessage("me@ToEmailAddress", "me@FromEmailAddress", emailTitle, body)      
                   
              Dim mailClient As New Net.Mail.SmtpClient("emailServer", port)
          
              Dim myCredentials As New System.Net.NetworkCredential("EmailUserName","EmailPassword")
          
              mailClient.UseDefaultCredentials = False
              mailClient.Credentials = myCredentials
              mailClient.Send(emailMessage)
          Hope this helps!

          -Frinny

          Comment

          Working...