“Quoted-printable line longer than 76 chars” warning when sending HTML E-Mail
Question
I have written some code in my VB.NET application to send an HTML e-mail (in this case, a lost password reminder).
When I test the e-mail, it gets eaten by my spam filter. One of the things that it's scoring badly on is because of the following problem:
MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 chars
I've been through the source of the e-mail, and I've broken each line longer than 76 characters into two lines with a CR+LF in between, but that hasn't fixed the problem.
Can anyone point me in the right direction?
Thanks!
Solution
Quoted printable expands 8 bit characters to "={HEX-Code}", thus making the messages longer. Maybe you are just hitting this limit?
Have you tried to break the message at, say, 70 characters? That should provide space for a couple of characters per line.
Or you just encode the email with Base64 - all mail client can handle that.
Or you just set Content-Transfer-Encoding to 8bit and send the data unencoded. I know of no mail server unable to handle 8bit bytes these days.
OTHER TIPS
This is a bug in the implementation of the Quoted-Printable encoding in System.Net.Mail.MailMessage, which has been there for a long time, but is apparently now fixed, as of .Net 4 Beta 2.
One work-around is to use Base64 encoding instead (even though it would not otherwise be good practice to send a plain-text MIME part in a non-human readable encoding like this). Asking the user of the class to manually split the lines of the message before sending it is not a general solution, as the modified message is not what they wanted to send (e.g. it might include a link which is longer than 76 chars, and so cannot be split). Quoted-Printable can handle messages with lines which are longer than 76 chars before encoding, as long as it is implemented correctly.