1

I am using System.Net.Mail.SmtpClient.Send() to send a System.Net.Mail.MailMessage object. The MailMessage object has the IsBodyHtml Property set to true. I have the following settings in my App.config file:

<system.net>
  <mailSettings>
    <smtp deliveryMethod="SpecifiedPickupDirectory" >
      <specifiedPickupDirectory pickupDirectoryLocation="C:\Pickup"/>
    </smtp>
  </mailSettings>
</system.net>

Some of the HTML in the email body is not being converted properly when the EML file is being generated. For example:

<img style="width:120px;height:160px;padding-left:2px;" src="http://images.mysite.com/image280.jpg" />

Becomes...

<img style=3D=
"width:120px;height:160px;padding-left:2px;" src=3D"http://images=
..mysite.com/image280.jpg" />

Notice the extra period before mysite.com in the src attribute. This is causing the image link to be broken and not display. It appears to be a bug with how lines are broken up in EML format. I cannot find any documentation online about it.

EDIT: I've noticed this happens everytime a line needs to break at a '.' (period) character. It puts two periods on the next line instead of one.

This post seems relevant but not sure if it will solve my problem. Do I need to change the Content-Transfer-Encoding property in my code?

Community
  • 1
  • 1
bovus
  • 73
  • 10

1 Answers1

3

I fixed my problem referring to the answer of this post. I simply set the BodyEncoding property of the MailMessage object to System.Text.Encoding.UTF8

Community
  • 1
  • 1
bovus
  • 73
  • 10