我使用VB.NET从ASP.NET表单发送电子邮件。我使用文件夹作为电子邮件的目的地。不幸的是,我看到' ='消息正文中每一行末尾的符号。
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Dim mailMessage As New MailMessage()
mailMessage.To.Add("someone@abc.com")
mailMessage.From = New MailAddress("someone@abc.com")
mailMessage.Subject = "Subject"
mailMessage.Body = ("<br>The following query was generated at " + DateTime.Now_+ "<br/><br/>Name : " + TextBox1.Text + "<br/><br/>Email : " + TextBox2.Text + "<br/><br/>Contact Number : " + TextBox3.Text + "<br/><br/>Query : " + TextBox4.Text)
mailMessage.IsBodyHtml = True
Dim smtpClient As New SmtpClient("localhost")
smtpClient.Credentials = System.Net.CredentialCache.DefaultCredentials
smtpClient.UseDefaultCredentials = True
smtpClient.Send(mailMessage)
Response.Write(" Email Sent ")
Catch ex As Exception
Response.Write("Error : " + ex.Message)
End Try
输出是这样的。
X-Sender: "Someone" <someone@abc.com>
X-Receiver: Someone@abc.com
MIME-Version: 1.0
From: "Someone" <Someone@abc.com>
To: Someone@abc.com
Date: 19 May 2015 19:35:49 +0530
Subject: Pink City Queries
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable`
<br>The following query was generated at 19-05-2015 19:35:49<br/>=
<br/>Name : Someone<br/><br/>Email : Someone@abc.com<br/><br/>Con=
tact Number : 0000000000<br/><br/>Query : Hello World!
答案 0 :(得分:5)
输出完全正确。没有必要摆脱任何东西。
电子邮件封装在quoted printable中,格式为=
表示换行符为 Soft Line Breaks 。
(Soft Line Breaks)Quoted-Printable编码 要求编码行不超过76行 长字符。如果要编码更长的行 使用Quoted-Printable编码时,必须使用“软”换行符。一个等号作为a的最后一个字符 编码行表示这种不重要(“软”) 编码文本中的换行符。
因此,如果线的“原始”形式是单个未编码的线,则 表示:
Now's the time for all folk to come to the aid of their country.
这可以在Quoted-Printable编码中表示为:
Now's the time = for all folk to come= to the aid of their country.
您可以使用电子邮件客户端或在线here验证这一点。