Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,047 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,680 people online right now. Registration is fast and FREE... Join Now!




help with sending html mail with vb.net 2005

 
Reply to this topicStart new topic

help with sending html mail with vb.net 2005

GoldenShot
27 Feb, 2008 - 06:01 AM
Post #1

New D.I.C Head
*

Joined: 15 Aug, 2007
Posts: 3


My Contributions
i have an interesting problem. i am using System.Net.Mail while sending mail. when i try to send html formiat mails it add 3D hwre start with =

i add code below for expamle

CODE

Imports System.IO
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing.Printing
Imports System.Net.Mail
Imports System.Net

    Dim mail As New MailMessage()
        mail.From = New MailAddress("from@mail.com", "test mail")
        mail.To.Add("to@mail.com")
        mail.Subject = "Test Message"
        mail.SubjectEncoding = System.Text.Encoding.UTF8
        mail.BodyEncoding = System.Text.Encoding.UTF8
        mail.IsBodyHtml = True

        mail.Body = "Test Message"


        Dim smtp As New SmtpClient()
        smtp.Credentials = New Net.NetworkCredential("user", "pass")
        smtp.Host = "host ip"
        smtp.Port = "port"
        If m_ssl = 1 = True Then
            smtp.EnableSsl = True
        ElseIf m_ssl = 0 Then
            smtp.EnableSsl = False
        End If

        smtp.Send(mail)


when i click to send it send. with sendind there is no problem.
But when i change body it happaed interesting things. like

CODE


Dim imgBuffer() As Byte = File.ReadAllBytes(img)
                Dim imageHTML As String = String.Format("<img src=""data:image/png;base64, {0}", Convert.ToBase64String(imgBuffer))

dim m_text as string
m_text +="<html>"
m_text +="<body>"
m_text +="test="
m_text +="<img src=""data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/ xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IAAAAddEVYdENvbW1lbnQAQ3
JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1JREFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2Jo
Q9LE1exdlYvBBeZ7jqch9// q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0vr4MkhoXe0rZigAAAABJRU5Er
kJggg==""   />"
m_text +="</body>"
m_text +="</html>"



aftrer text= it add 3D
in mail source it look line test=3D and page not looking good.

the sourse i send up there in mail sourse it look like this:

<html>=0D=0A<body>=0D=0Atest=3D=0D=0A<img src=3D"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/ xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IAAAAddEVYdENvbW1lbnQAQ3
JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1JREFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2Jo
Q9LE1exdlYvBBeZ7jqch9// q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0vr4MkhoXe0rZigAAAABJRU5Er
kJggg=3D=3D"=
/>=0D=0A</body>=0D=0A</html>=0D=0A

why it is addin these extra codes in mail ? how can i correct this problem?


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:10PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month