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. vbSendMail does not send email

vbSendMail does not send email

Scheduled Pinned Locked Moved Visual Basic
helpvisual-studiosysadmindebugging
4 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.
  • T Offline
    T Offline
    tatchung
    wrote on last edited by
    #1

    Hello! I've an application that uses vbSendMail.dll for emails. When in debug mode the application works smoothly. However once I've compiled/packaged the app using VS package and deployment wizard it does not send emails. Weird thing is it does not generate any error. vbSendMail.dll and mswinsck.ocx both have been included in the package and registered successfully. By the way I'm using vb6 for this app. This is the part of the email code

    Set vbemail = New vbSendMail.clsSendMail
    vbemail.SMTPHost = "****.*****.***"
    vbemail.FromDisplayName = ""
    sendemail
    ...................
    vbemail.From = senderemail
    vbemail.CcRecipient = "*********"
    For i = 1 To Adodc3.Recordset.RecordCount
    vbemail.Recipient = vbemail.Recipient + Adodc3.Recordset!email + ";"
    Adodc3.Recordset.MoveNext
    Next i

            If Not txtemail.Text = "" Then
                vbemail.CcRecipient = vbemail.CcRecipient + ";" + txtemail.Text
            End If
    
            vbemail.Attachment = Adodc1.Recordset!screenshot
            vbemail.Subject = "\[INCIDENT\] WSA " & Adodc1.Recordset!incident & "  " & Adodc1.Recordset!datereported
            vbemail.Message = "Hi Sir/Ma'am" & Chr(13) & Chr(13) & "IR NO. : " & Adodc1.Recordset!irno & Chr(13) & "STATUS: " & Adodc1.Recordset!Status & Chr(13) & "PROBLEM CLASSIFICATION: " & Adodc1.Recordset!problemclassification & Chr(13) & "PROBLEM: " & Adodc1.Recordset!problem & Chr(13) & "RESOLUTION: " & Adodc1.Recordset!resolution & Chr(13) & Chr(13) & "WEBSITE: " & Adodc1.Recordset!websitename & Chr(13) & "DETAILS:" & Adodc1.Recordset!details & Chr(13) & "URL / LINK: " & Adodc1.Recordset!url & Chr(13) & "BROWSER USED: " & Adodc1.Recordset!browsertype & Chr(13) & Chr(13) & fulln & Chr(13) & departmnt
            vbemail.Send
            Set vbemail = Nothing
            MsgBox "Email Sent", vbExclamation
    

    Thanks in advance for any assistance on this dilemma :-O

    Aim small, miss small

    L M 2 Replies Last reply
    0
    • T tatchung

      Hello! I've an application that uses vbSendMail.dll for emails. When in debug mode the application works smoothly. However once I've compiled/packaged the app using VS package and deployment wizard it does not send emails. Weird thing is it does not generate any error. vbSendMail.dll and mswinsck.ocx both have been included in the package and registered successfully. By the way I'm using vb6 for this app. This is the part of the email code

      Set vbemail = New vbSendMail.clsSendMail
      vbemail.SMTPHost = "****.*****.***"
      vbemail.FromDisplayName = ""
      sendemail
      ...................
      vbemail.From = senderemail
      vbemail.CcRecipient = "*********"
      For i = 1 To Adodc3.Recordset.RecordCount
      vbemail.Recipient = vbemail.Recipient + Adodc3.Recordset!email + ";"
      Adodc3.Recordset.MoveNext
      Next i

              If Not txtemail.Text = "" Then
                  vbemail.CcRecipient = vbemail.CcRecipient + ";" + txtemail.Text
              End If
      
              vbemail.Attachment = Adodc1.Recordset!screenshot
              vbemail.Subject = "\[INCIDENT\] WSA " & Adodc1.Recordset!incident & "  " & Adodc1.Recordset!datereported
              vbemail.Message = "Hi Sir/Ma'am" & Chr(13) & Chr(13) & "IR NO. : " & Adodc1.Recordset!irno & Chr(13) & "STATUS: " & Adodc1.Recordset!Status & Chr(13) & "PROBLEM CLASSIFICATION: " & Adodc1.Recordset!problemclassification & Chr(13) & "PROBLEM: " & Adodc1.Recordset!problem & Chr(13) & "RESOLUTION: " & Adodc1.Recordset!resolution & Chr(13) & Chr(13) & "WEBSITE: " & Adodc1.Recordset!websitename & Chr(13) & "DETAILS:" & Adodc1.Recordset!details & Chr(13) & "URL / LINK: " & Adodc1.Recordset!url & Chr(13) & "BROWSER USED: " & Adodc1.Recordset!browsertype & Chr(13) & Chr(13) & fulln & Chr(13) & departmnt
              vbemail.Send
              Set vbemail = Nothing
              MsgBox "Email Sent", vbExclamation
      

      Thanks in advance for any assistance on this dilemma :-O

      Aim small, miss small

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I don't know if that is .net or vb6, but I would tell you to check out This[^] article on how you can send emails with the .net framework.

      1 Reply Last reply
      0
      • T tatchung

        Hello! I've an application that uses vbSendMail.dll for emails. When in debug mode the application works smoothly. However once I've compiled/packaged the app using VS package and deployment wizard it does not send emails. Weird thing is it does not generate any error. vbSendMail.dll and mswinsck.ocx both have been included in the package and registered successfully. By the way I'm using vb6 for this app. This is the part of the email code

        Set vbemail = New vbSendMail.clsSendMail
        vbemail.SMTPHost = "****.*****.***"
        vbemail.FromDisplayName = ""
        sendemail
        ...................
        vbemail.From = senderemail
        vbemail.CcRecipient = "*********"
        For i = 1 To Adodc3.Recordset.RecordCount
        vbemail.Recipient = vbemail.Recipient + Adodc3.Recordset!email + ";"
        Adodc3.Recordset.MoveNext
        Next i

                If Not txtemail.Text = "" Then
                    vbemail.CcRecipient = vbemail.CcRecipient + ";" + txtemail.Text
                End If
        
                vbemail.Attachment = Adodc1.Recordset!screenshot
                vbemail.Subject = "\[INCIDENT\] WSA " & Adodc1.Recordset!incident & "  " & Adodc1.Recordset!datereported
                vbemail.Message = "Hi Sir/Ma'am" & Chr(13) & Chr(13) & "IR NO. : " & Adodc1.Recordset!irno & Chr(13) & "STATUS: " & Adodc1.Recordset!Status & Chr(13) & "PROBLEM CLASSIFICATION: " & Adodc1.Recordset!problemclassification & Chr(13) & "PROBLEM: " & Adodc1.Recordset!problem & Chr(13) & "RESOLUTION: " & Adodc1.Recordset!resolution & Chr(13) & Chr(13) & "WEBSITE: " & Adodc1.Recordset!websitename & Chr(13) & "DETAILS:" & Adodc1.Recordset!details & Chr(13) & "URL / LINK: " & Adodc1.Recordset!url & Chr(13) & "BROWSER USED: " & Adodc1.Recordset!browsertype & Chr(13) & Chr(13) & fulln & Chr(13) & departmnt
                vbemail.Send
                Set vbemail = Nothing
                MsgBox "Email Sent", vbExclamation
        

        Thanks in advance for any assistance on this dilemma :-O

        Aim small, miss small

        M Offline
        M Offline
        Mr Oizo
        wrote on last edited by
        #3

        I don't have the solution to your problem but I do have code that will work for you try:

        Dim myMail As New MailMessage()
        Dim eFrom As New MailAddress("*****@****.***")
        myMail.From = eFrom

            myMail.To.Add("\*\*\*\*\*@\*\*\*\*\*.\*\*\*")
            
            myMail.Subject = "Your subject"
            myMail.Priority = MailPriority.High
            myMail.Body = "Your message"
            Dim myAttachment As New Attachment("your attachment")
        

        myMail.Attachments.Add(myAttachment)

            Dim smtpClient As New SmtpClient("\*\*.\*\*.\*\*.\*\*")    'Whatever your mail server address is
            smtpClient.Send(myMail)
        

        Replacing any * with the proper character and leaving out anything you don't need. Also remember to import Imports System.Net.Mail

        L 1 Reply Last reply
        0
        • M Mr Oizo

          I don't have the solution to your problem but I do have code that will work for you try:

          Dim myMail As New MailMessage()
          Dim eFrom As New MailAddress("*****@****.***")
          myMail.From = eFrom

              myMail.To.Add("\*\*\*\*\*@\*\*\*\*\*.\*\*\*")
              
              myMail.Subject = "Your subject"
              myMail.Priority = MailPriority.High
              myMail.Body = "Your message"
              Dim myAttachment As New Attachment("your attachment")
          

          myMail.Attachments.Add(myAttachment)

              Dim smtpClient As New SmtpClient("\*\*.\*\*.\*\*.\*\*")    'Whatever your mail server address is
              smtpClient.Send(myMail)
          

          Replacing any * with the proper character and leaving out anything you don't need. Also remember to import Imports System.Net.Mail

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You can't "imports" the .NET Framework libraries in VB6.. You can however, make a small executable that sends the file in VB.NET (download the VB.NET Express IDE, it's for free) and launch this process from VB6 whenever you need to send a mail :)

          I are troll :)

          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