I am using System.Net.Mail.SmtpClient
to send e-mails through a remote SMTP server. When I'm looking at the headers of the sent message, I see that the message gets 2.5 hits from X-Spam. How can I prevent base64 encoding of the From
field, and how to get rid of the NULL_IN_BODY
hit? Even though it's not marked as spam, I want it to be perfect. I'm unable to find any information regarding this issue (if it really is an issue at all).
MIME-Version: 1.0
From: Myself <no-reply@myself.com>
To: me@myself.com
Date: 25 Mar 2011 15:20:23 +0100
Subject: Test subject
Content-Type: text/plain; charset=us-ascii
X-Spam-Status: No, hits=0.5 required=5.0
X-Spam-Report: 0.5 hits, 5.0 required;
* -0.5 ALL_TRUSTED Passed through trusted hosts only via SMTP
* 1.0 NULL_IN_BODY FULL: Message has NUL (ASCII 0) byte in message
X-Virus-Scanned: by moam (http://www.moam.net/)
X-Moam-Version: 0.95
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by mx02.example.com id p2PEKKNs014451
Hello, sshow!
Below is your login information
Username: sshow
Password: a8sJdfl
Sent from http://me.myself.com
Edit: I managed to remove the warning for FROM_EXCESS_BASE64
, which was the most important one, by removing all encoding for the field. I had previously manually set Encoding.UTF8
for the field.
By removing all control characters from body
string, it no longer raises the warning. However, this also removes the line-breaks.
foreach (char c in body)
{
stringBuilder.Append(Char.IsControl(c) ? ' ' : c);
}
Edit: When removing all control-chars except line-breaks, the warning returns!
foreach (char c in body)
{
stringBuilder.Append(Char.IsControl(c) && c != '\r' && c != '\n' ? ' ' : c);
}