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. Error sending mail using smtp

Error sending mail using smtp

Scheduled Pinned Locked Moved Visual Basic
csharpcomtoolshelp
5 Posts 3 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
    A
    wrote on last edited by
    #1

    This is the code i am using to try and send an email. I am using vb.net 2003 Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click If txtto.Text = "" Then MsgBox("Please enter the address to send this message, E.g, Someone@someone.com") End If If txtto.Text <> "" Then Dim email As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage email.To = txtto.Text email.Cc = txtcc.Text email.Bcc = txtbcc.Text email.Subject = txtsubject.Text email.From = "someone@someone.com" email.Body = txtmessage.Text Dim sAttach As String = txtattach.Text If txtattach.Text <> "" Then Dim delim As Char = "," Dim sSubstr As String For Each sSubstr In sAttach.Split(delim) Dim myAttachment As MailAttachment = New MailAttachment(sSubstr) email.Attachments.Add(myAttachment) Next End If System.Web.Mail.SmtpMail.SmtpServer = "" System.Web.Mail.SmtpMail.Send(email) Error here End If End Sub Error I get: An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll Additional information: Could not access 'CDO.Message' object.

    My blog:[^]

    D A A 4 Replies Last reply
    0
    • A A

      This is the code i am using to try and send an email. I am using vb.net 2003 Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click If txtto.Text = "" Then MsgBox("Please enter the address to send this message, E.g, Someone@someone.com") End If If txtto.Text <> "" Then Dim email As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage email.To = txtto.Text email.Cc = txtcc.Text email.Bcc = txtbcc.Text email.Subject = txtsubject.Text email.From = "someone@someone.com" email.Body = txtmessage.Text Dim sAttach As String = txtattach.Text If txtattach.Text <> "" Then Dim delim As Char = "," Dim sSubstr As String For Each sSubstr In sAttach.Split(delim) Dim myAttachment As MailAttachment = New MailAttachment(sSubstr) email.Attachments.Add(myAttachment) Next End If System.Web.Mail.SmtpMail.SmtpServer = "" System.Web.Mail.SmtpMail.Send(email) Error here End If End Sub Error I get: An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll Additional information: Could not access 'CDO.Message' object.

      My blog:[^]

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

      There's lots of info out on the web about this. All you have to do is Google "tourbleshooting CDO.Message[^]".

      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      • A A

        This is the code i am using to try and send an email. I am using vb.net 2003 Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click If txtto.Text = "" Then MsgBox("Please enter the address to send this message, E.g, Someone@someone.com") End If If txtto.Text <> "" Then Dim email As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage email.To = txtto.Text email.Cc = txtcc.Text email.Bcc = txtbcc.Text email.Subject = txtsubject.Text email.From = "someone@someone.com" email.Body = txtmessage.Text Dim sAttach As String = txtattach.Text If txtattach.Text <> "" Then Dim delim As Char = "," Dim sSubstr As String For Each sSubstr In sAttach.Split(delim) Dim myAttachment As MailAttachment = New MailAttachment(sSubstr) email.Attachments.Add(myAttachment) Next End If System.Web.Mail.SmtpMail.SmtpServer = "" System.Web.Mail.SmtpMail.Send(email) Error here End If End Sub Error I get: An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll Additional information: Could not access 'CDO.Message' object.

        My blog:[^]

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

        Try this code. Hope this will help u. Public Function OpenEmail(ByVal EmailAddress As String) ', Optional ByVal Subject As String = "", Optional ByVal Body As String = "") As Boolean Dim bAns As Boolean = True Dim sParams As String sParams = EmailAddress If LCase(Strings.Left(sParams, 7)) <> "mailto:" Then sParams = "mailto:" & sParams 'If Subject <> "" Then sParams = sParams & _ ' "?subject=" & Subject 'If Body <> "" Then ' sParams = sParams & IIf(Subject = "", "?", "&") ' sParams = sParams & "body=" & Body 'End If Try System.Diagnostics.Process.Start(sParams) Catch bAns = False End Try Return bAns End Function

        1 Reply Last reply
        0
        • A A

          This is the code i am using to try and send an email. I am using vb.net 2003 Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click If txtto.Text = "" Then MsgBox("Please enter the address to send this message, E.g, Someone@someone.com") End If If txtto.Text <> "" Then Dim email As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage email.To = txtto.Text email.Cc = txtcc.Text email.Bcc = txtbcc.Text email.Subject = txtsubject.Text email.From = "someone@someone.com" email.Body = txtmessage.Text Dim sAttach As String = txtattach.Text If txtattach.Text <> "" Then Dim delim As Char = "," Dim sSubstr As String For Each sSubstr In sAttach.Split(delim) Dim myAttachment As MailAttachment = New MailAttachment(sSubstr) email.Attachments.Add(myAttachment) Next End If System.Web.Mail.SmtpMail.SmtpServer = "" System.Web.Mail.SmtpMail.Send(email) Error here End If End Sub Error I get: An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll Additional information: Could not access 'CDO.Message' object.

          My blog:[^]

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

          A***** wrote:

          System.Web.Mail.SmtpMail.SmtpServer = ""

          Sorry, I missed this line before. You MUST specify an SMTP server to use, either by IP address or by a valid DNS name. You cannot send mail without one.

          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          1 Reply Last reply
          0
          • A A

            This is the code i am using to try and send an email. I am using vb.net 2003 Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click If txtto.Text = "" Then MsgBox("Please enter the address to send this message, E.g, Someone@someone.com") End If If txtto.Text <> "" Then Dim email As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage email.To = txtto.Text email.Cc = txtcc.Text email.Bcc = txtbcc.Text email.Subject = txtsubject.Text email.From = "someone@someone.com" email.Body = txtmessage.Text Dim sAttach As String = txtattach.Text If txtattach.Text <> "" Then Dim delim As Char = "," Dim sSubstr As String For Each sSubstr In sAttach.Split(delim) Dim myAttachment As MailAttachment = New MailAttachment(sSubstr) email.Attachments.Add(myAttachment) Next End If System.Web.Mail.SmtpMail.SmtpServer = "" System.Web.Mail.SmtpMail.Send(email) Error here End If End Sub Error I get: An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll Additional information: Could not access 'CDO.Message' object.

            My blog:[^]

            A Offline
            A Offline
            A
            wrote on last edited by
            #5

            Thanks for the help, amaneet and dave.

            My blog:[^]

            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