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. Try to send email

Try to send email

Scheduled Pinned Locked Moved Visual Basic
helpcsharpsysadmindebugging
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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    I'm trying to send email from within VB.NET and I get the following error: "Could not access 'CDO.Message' object." when I try to send the message. Here's a brief summary of my config: Running Windows 2000, SP3 on our Company Ethernet with MS Echange email server Code: Imports System.Web.Mail 'These 3 were added while I was debugging the problem, but they don't seem to help Imports CDO Imports MAPI Imports MSMAPI . . Dim MailMsg As System.Web.Mail.MailMessage Dim MailSrvr As System.Web.Mail.SmtpMail . . . . MailMsg = New System.Web.Mail.MailMessage() MailMsg.From = "from@email" MailMsg.Body = "Test Message!" MailMsg.Subject = "HI" MailMsg.To = "to@email" Try MailSrvr.Send(MailMsg) Catch err As Exception Debug.WriteLine(err.Message) End Try Without fail, I get the error message. It seems to me that the code is right, but I must be missing a service or config somewhere. I've searched high and low on the web, MSDN, and .NET's sorry documentation but can't find out what's up. Any ideas?

    N 1 Reply Last reply
    0
    • A Anonymous

      I'm trying to send email from within VB.NET and I get the following error: "Could not access 'CDO.Message' object." when I try to send the message. Here's a brief summary of my config: Running Windows 2000, SP3 on our Company Ethernet with MS Echange email server Code: Imports System.Web.Mail 'These 3 were added while I was debugging the problem, but they don't seem to help Imports CDO Imports MAPI Imports MSMAPI . . Dim MailMsg As System.Web.Mail.MailMessage Dim MailSrvr As System.Web.Mail.SmtpMail . . . . MailMsg = New System.Web.Mail.MailMessage() MailMsg.From = "from@email" MailMsg.Body = "Test Message!" MailMsg.Subject = "HI" MailMsg.To = "to@email" Try MailSrvr.Send(MailMsg) Catch err As Exception Debug.WriteLine(err.Message) End Try Without fail, I get the error message. It seems to me that the code is right, but I must be missing a service or config somewhere. I've searched high and low on the web, MSDN, and .NET's sorry documentation but can't find out what's up. Any ideas?

      N Offline
      N Offline
      Nick Seng
      wrote on last edited by
      #2

      Have you set the MailSrvr.SmtpServer property yet??. You need to set it to the IP of your Mail Server. Notorious SMC


      The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain
      Get your facts first, and then you can distort them as much as you please Mark Twain

      A 1 Reply Last reply
      0
      • N Nick Seng

        Have you set the MailSrvr.SmtpServer property yet??. You need to set it to the IP of your Mail Server. Notorious SMC


        The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain
        Get your facts first, and then you can distort them as much as you please Mark Twain

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Thank you for your help. It seems so obvious :-O, but none of the examples or references I had found, actually said that. I set it to the name of our mail server, and it worked.

        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