Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. E-Mail problems with SMTP

E-Mail problems with SMTP

Scheduled Pinned Locked Moved Visual Basic
csharpcomsysadminhelpworkspace
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KreativeKai
    wrote on last edited by
    #1

    I'm using System.Web.Mail to send e-mails out via smtp using the code below: Dim Message As System.Web.mail.MailMessage = New System.Web.Mail.MailMessage Message.To = "someone@outside.com" Message.From = "me@mycompany.com" Message.Subject = "test" Message.Body = "test" Message.BodyFormat = MailFormat.Text SmtpMail.SmtpServer = "MY_EX" 'MY_EX = internal exchange server SmtpMail.Send(Message) When I send to someone within my company it works like a charm. When I send to an address outside it gives me an error: Could not access 'CDO.Message' object. If I change the SmtpMail.SmtpServer to "localhost" it works fine for the reverse, external but not internal addresses. This setup however doesn't create an error but the internal addresses never receive the message, only the external. Can someone shed some light on what I'm doing wrong. Any suggestions are appreciated. Thanks, Kevin :sigh: Lost in the vast sea of .NET

    M 1 Reply Last reply
    0
    • K KreativeKai

      I'm using System.Web.Mail to send e-mails out via smtp using the code below: Dim Message As System.Web.mail.MailMessage = New System.Web.Mail.MailMessage Message.To = "someone@outside.com" Message.From = "me@mycompany.com" Message.Subject = "test" Message.Body = "test" Message.BodyFormat = MailFormat.Text SmtpMail.SmtpServer = "MY_EX" 'MY_EX = internal exchange server SmtpMail.Send(Message) When I send to someone within my company it works like a charm. When I send to an address outside it gives me an error: Could not access 'CDO.Message' object. If I change the SmtpMail.SmtpServer to "localhost" it works fine for the reverse, external but not internal addresses. This setup however doesn't create an error but the internal addresses never receive the message, only the external. Can someone shed some light on what I'm doing wrong. Any suggestions are appreciated. Thanks, Kevin :sigh: Lost in the vast sea of .NET

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Kevin. Does your internal exchange server have any rules set up to prevent its use as an smtp mail relay? One thing I've found is helpful when diagnosing the "Could not access 'CDO.Message' object" error is to look at the InnerException property of the Exception object you catch; if one is there, output its message and see if that sheds more light on the problem. If the InnerException exists, also check to see if it has its own InnerException. Keep going until you hit an InnerException = nothing. It may be there are nested exceptions, leading to the outer exception you trap as a 'CDO.Message' error.

      K 1 Reply Last reply
      0
      • M Mike Ellison

        Hi Kevin. Does your internal exchange server have any rules set up to prevent its use as an smtp mail relay? One thing I've found is helpful when diagnosing the "Could not access 'CDO.Message' object" error is to look at the InnerException property of the Exception object you catch; if one is there, output its message and see if that sheds more light on the problem. If the InnerException exists, also check to see if it has its own InnerException. Keep going until you hit an InnerException = nothing. It may be there are nested exceptions, leading to the outer exception you trap as a 'CDO.Message' error.

        K Offline
        K Offline
        KreativeKai
        wrote on last edited by
        #3

        I posted my question on 4 different message boards and received great feedback from all. I like to take the info I received and post the solution if possible so others might benefit if they run into the same problem. There is a great website that was suggested and I used which gives in depth info on System.WebMail. The site is http://www.systemwebmail.net/ and I would highly recommend it to anyone with questions like the one I had. Also, one suggestion was to look for the inner exception. I used the following code and found that my inner exception gave me much more info as to what my real problem was. My inner exception was ‘550 Relaying is prohibited’. Relaying needs to be configured correctly on our server. Without the inner exception, I wouldn’t have known this. Try SmtpMail.SmtpServer = "EX_SRVR" SmtpMail.Send(Message) Catch ex As System.Web.HttpException strLogMsg = "Error connecting to exchange server: " ex.Message If ex.InnerException.ToString <> Nothing Then MsgBox("The following InnerException reported: " & ex.InnerException.ToString) End If End Try Thanks again to all!! :) Lost in the vast sea of .NET

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups