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. how 2 send pic with mail plz help!

how 2 send pic with mail plz help!

Scheduled Pinned Locked Moved Visual Basic
helpcsharphtmlcomsysadmin
3 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.
  • K Offline
    K Offline
    King of Kingz
    wrote on last edited by
    #1

    i m using Smtp for sending mail. I m getting body text from an html editor. This editor uses webbrowser control. Problem is this, when i put an image on the webbrowser control and send it to a mailing address it don't show the pic but all the test is ok. here's the code i use. Dim MailObj As Net.Mail.MailMessage = New Net.Mail.MailMessage() MailObj.To.Add("sampleemailaddress@exampledomain.com") MailObj.From = New Net.Mail.MailAddress("myemailaddress@somedomain.com", "King") mailObj.Priority = Net.Mail.MailPriority.Normal MailObj.Subject = "This is test mail" mailObj.Body = WebBrowser1.DocumentText Dim smtpcli As Net.Mail.SmtpClient = New Net.Mail.SmtpClient("smtp.gmail.com", 587) smtpcli.EnableSsl = True smtpcli.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network smtpcli.Credentials = New Net.NetworkCredential("someemailaddress@gmail.com", "password") Try smtpcli.Send(MailObj) MsgBox("Email successfully delivered.") Catch ex As Exception MsgBox(ex.ToString()) End Try Thx in advance for any help.....

    King

    _ A 2 Replies Last reply
    0
    • K King of Kingz

      i m using Smtp for sending mail. I m getting body text from an html editor. This editor uses webbrowser control. Problem is this, when i put an image on the webbrowser control and send it to a mailing address it don't show the pic but all the test is ok. here's the code i use. Dim MailObj As Net.Mail.MailMessage = New Net.Mail.MailMessage() MailObj.To.Add("sampleemailaddress@exampledomain.com") MailObj.From = New Net.Mail.MailAddress("myemailaddress@somedomain.com", "King") mailObj.Priority = Net.Mail.MailPriority.Normal MailObj.Subject = "This is test mail" mailObj.Body = WebBrowser1.DocumentText Dim smtpcli As Net.Mail.SmtpClient = New Net.Mail.SmtpClient("smtp.gmail.com", 587) smtpcli.EnableSsl = True smtpcli.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network smtpcli.Credentials = New Net.NetworkCredential("someemailaddress@gmail.com", "password") Try smtpcli.Send(MailObj) MsgBox("Email successfully delivered.") Catch ex As Exception MsgBox(ex.ToString()) End Try Thx in advance for any help.....

      King

      _ Offline
      _ Offline
      _mubashir
      wrote on last edited by
      #2

      Try and change the mail type to HTML and then you can send anything formatted well in HTML.


      Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.

      1 Reply Last reply
      0
      • K King of Kingz

        i m using Smtp for sending mail. I m getting body text from an html editor. This editor uses webbrowser control. Problem is this, when i put an image on the webbrowser control and send it to a mailing address it don't show the pic but all the test is ok. here's the code i use. Dim MailObj As Net.Mail.MailMessage = New Net.Mail.MailMessage() MailObj.To.Add("sampleemailaddress@exampledomain.com") MailObj.From = New Net.Mail.MailAddress("myemailaddress@somedomain.com", "King") mailObj.Priority = Net.Mail.MailPriority.Normal MailObj.Subject = "This is test mail" mailObj.Body = WebBrowser1.DocumentText Dim smtpcli As Net.Mail.SmtpClient = New Net.Mail.SmtpClient("smtp.gmail.com", 587) smtpcli.EnableSsl = True smtpcli.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network smtpcli.Credentials = New Net.NetworkCredential("someemailaddress@gmail.com", "password") Try smtpcli.Send(MailObj) MsgBox("Email successfully delivered.") Catch ex As Exception MsgBox(ex.ToString()) End Try Thx in advance for any help.....

        King

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

        Just declare a MailAttachment object give the path of Image to its constructor and then Add it into the Attachment collection of your Mail Message object e.g.

            Dim imgAt As New MailAttachment("ImagePath")
            MailObj.Attachments.Add(imgAt)
        

        Good Luck !

        AliAmjad(MCP) First make it Run THEN make it Run Fast!

        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