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. email

email

Scheduled Pinned Locked Moved Visual Basic
helpcsharpsysadminquestioncareer
4 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.
  • M Offline
    M Offline
    Michael Bailey
    wrote on last edited by
    #1

    Hi all! I’m new to the group; I had a friend in my computer science class tell me about the group. So my problem is this. I’m building a program for a charity group what they want it to do is take a picture of someone via webcam and then email it to anyone the use specifies a lot like the one at the Microsoft Museum If anyone has been there. So it has turned into my class project. I have ran into a problem with the sending of the email. The program won’t be using a local SMTP server it will be using one like Comcast (smtp.comcast.net) when I run the program everything is fine until it runs the last line of code and then I get this error message. An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll Additional information: Could not access 'CDO.Message' object. I was wondering if anyone could help me with it? I have tried declaring the SMTP server in different areas but nothing seems to work Thanks for any help Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim **objEmailMessage** As System.Web.Mail.MailMessage Dim objSMTPServer As System.Web.Mail.SmtpMail objSMTPServer.SmtpServer = "smtp.comcast.net" objEmailMessage = New System.Web.Mail.MailMessage With objEmailMessage .To = "crazyboutcomputers1@comcast.net" .From = txtFrom.Text .Subject = "Great Job!" .Body = "Want all my money?" End With **objSMTPServer.Send(objEmailMessage)** End Sub The code in red at the bottom is what im have truble with and when i click go to definition it gos to the one in green at the top. Agen Thanks for any Help

    D 1 Reply Last reply
    0
    • M Michael Bailey

      Hi all! I’m new to the group; I had a friend in my computer science class tell me about the group. So my problem is this. I’m building a program for a charity group what they want it to do is take a picture of someone via webcam and then email it to anyone the use specifies a lot like the one at the Microsoft Museum If anyone has been there. So it has turned into my class project. I have ran into a problem with the sending of the email. The program won’t be using a local SMTP server it will be using one like Comcast (smtp.comcast.net) when I run the program everything is fine until it runs the last line of code and then I get this error message. An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll Additional information: Could not access 'CDO.Message' object. I was wondering if anyone could help me with it? I have tried declaring the SMTP server in different areas but nothing seems to work Thanks for any help Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim **objEmailMessage** As System.Web.Mail.MailMessage Dim objSMTPServer As System.Web.Mail.SmtpMail objSMTPServer.SmtpServer = "smtp.comcast.net" objEmailMessage = New System.Web.Mail.MailMessage With objEmailMessage .To = "crazyboutcomputers1@comcast.net" .From = txtFrom.Text .Subject = "Great Job!" .Body = "Want all my money?" End With **objSMTPServer.Send(objEmailMessage)** End Sub The code in red at the bottom is what im have truble with and when i click go to definition it gos to the one in green at the top. Agen Thanks for any Help

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Your problem is that you instantiated an SmtpMail object. You don't have to. SmtpMail is one of those objects that you just use, kind of like a service that's been declared already. Just a little tweak of your code results in this:

          Dim objEmailMessage As System.Web.Mail.MailMessage
      
          objEmailMessage = New System.Web.Mail.MailMessage
          With objEmailMessage
              .To = "crazyboutcomputers1@comcast.net"
              .From = txtFrom.Text
              .Subject = "Great Job!"
              .Body = "Want all my money?"
      
          End With
          SmtpMail.SmtpServer = "smtp.comcast.net"
          SmtpMail.Send(objEmailMessage)
      

      This should work for you. Oh! Don't forget the reference to System.Web! RageInTheMachine9532

      M 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Your problem is that you instantiated an SmtpMail object. You don't have to. SmtpMail is one of those objects that you just use, kind of like a service that's been declared already. Just a little tweak of your code results in this:

            Dim objEmailMessage As System.Web.Mail.MailMessage
        
            objEmailMessage = New System.Web.Mail.MailMessage
            With objEmailMessage
                .To = "crazyboutcomputers1@comcast.net"
                .From = txtFrom.Text
                .Subject = "Great Job!"
                .Body = "Want all my money?"
        
            End With
            SmtpMail.SmtpServer = "smtp.comcast.net"
            SmtpMail.Send(objEmailMessage)
        

        This should work for you. Oh! Don't forget the reference to System.Web! RageInTheMachine9532

        M Offline
        M Offline
        Michael Bailey
        wrote on last edited by
        #3

        the error I'm geting now is ( name smtpmail not decalrad ) Its refuring to the last 2 lines of code.

        D 1 Reply Last reply
        0
        • M Michael Bailey

          the error I'm geting now is ( name smtpmail not decalrad ) Its refuring to the last 2 lines of code.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Do you have this at the top of your code? I assumed you did already, based on your example. My mistake! :doh:

          Imports System.Web.Mail

          RageInTheMachine9532

          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