Get rid of spam-filter points with System.Net.Mail

I send mail with an asp net routine that previously triggered just enough spam points to get marked as spam by some mail server spam filters.

pts rule name description

---- ----------------------  --------------------------------------------------
 2.9  BAD_ENC_HEADER         Message has bad MIME encoding in the header
 0.0 HTML_MESSAGE           BODY: HTML included in message
 1.7  MIME_HTML_ONLY         BODY: Message only has text/html MIME parts
 1.1 HTML_MIME_NO_HTML_TAG  HTML-only message, but there is no HTML tag
After quite some research I found that BAD_ENC_HEADER was due to the sender address was coded like this
From: “=?utf-8?Q?V=C3=A5r admin?=” <me@my.org>

The problem is that encoded strings should not include whitespaces. And I do not know why .Net adds a whitespace here – possibly a bug – my temporary workaround was to remove the name from the sender address and only include the emailaddress.
Another problem (HTML_MIME_NO_HTML_TAG) was I thought Mail.IsHtml=True should add the HTML tag for me, it didn’t, so I just had to enclose my body message within <html>.

UPDATE: After taking care of the messages above (with the temporary workaround) I got yet two others:

 1.1 MPART_ALT_DIFF         BODY: HTML and text parts are different
 1.8 MIME_QP_LONG_LINE      RAW: Quoted-printable line longer than 76 chars

And it seems that the MIME_QP_LONG_LINE is due to a bug (as well as the whitespace described above) in System.Net.Mail.

Here’s a post mentioning it: http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/879f13d7-24e6-4a0f-b396-627e9da25fc1/ MS reply is “We plan to address all of these issues in .NET 4.0.”

So now I’m probably going to use this library instead of System.Net.Mail http://www.codeproject.com/KB/IP/MailMergeLib.aspx

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s