views:

488

answers:

8

I am sending a new logon and password to a user, however when I do on a test version of our site on the internet the Spam score is 4.6 by spam assassin. Which means it gets trapped.

The Email is HTML (so the marketing dept have their nice fonts and colours) with a linked image.

The MailMessage() object does not appear to give me a lot of control over the output format of the message.

What measures could I take to lower the spam score?

I am sending using this:

/* send an email */
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;
//msg.BodyEncoding = Encoding.UTF8;
msg.To.Add(new MailAddress(sToEmail));
msg.From = new MailAddress(sFromEmail);
msg.Subject = sEmailSubject;
msg.Body = sEmailTemplate;
try
{
    client.Send(msg);
}

The spam score is this:

X-Spam-Score: 4.6 (++++)
X-Spam-Report: Spam detection software report (4.6 points):
    pts rule name              description
    ---- ---------------------- --------------------------------------------------
    1.8 HTML_IMAGE_ONLY_20     BODY: HTML: images with 1600-2000 bytes of words
    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
    0.1 RDNS_NONE              Delivered to trusted network by a host with no rDNS
+5  A: 

It seems like it doesn't matter how you send the message that effects the spam score, but what the message contains.

Try different versions of the message contents and see what else can change.

1.8 points seems to be from the images. Take out the images.

How are you creating the HTML? I would look at all those factors before I would look at changing how the message is sent, because that is not a factor in spam.

David Basarab
+1, +!. Images are almost always unnecessary in emails, and they're an important indicator of spam! Don't bother with them. If you must use HTML, do so only for fonts and colors. Header images add nothing to the user experience *and are frequently blocked by email clients anyway*.
Randolpho
+2  A: 

1.1 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag

Well for one, you need an HTML tag around your HTML message. If you make your HTML validate, it seems like it'd lower the score a bit. That'd knock you down to 3.5 points.

Don't forget a nice friendly name in your from address too, that's making our emails get caught up in filters.

email from: J Random Hacker <[email protected]>

is better than [email protected]

Broam
+2  A: 

You are answering your own question. By not sending "images with 1600-2000 bytes of words", "HTML included in message", "Message only has text/html MIME parts" or "HTML-only message, but there is no HTML tag" you will substract spam points from the formula and hence the result will be lower.

An (inferior) alternative is to ask the user to whitelist you.

Daniel Daranas
+2  A: 

I don't know much about Spam Assasin, but I've used Return Path in the past. They give a rather comprehensive view of the aspects of an email that make it look like spam.

I don't work for Return Path, btw :)

Dave Swersky
+14  A: 

Two solutions:

  1. Add more content, so that the <img> is not the main part of the email - loads more content in clean text without tags. (I know it looks lame, but copyright notices, unsubscribe instructions and registration rules make a really good text padding) Add a text-only version in a new mime part. Send a properly constructed HTML which actually contains the <html> tag.

  2. Smack marketing people with a clue-by-four many times and send text emails in text only - as $DEITY intended.

viraptor
+1 for use of $DIETY and smacking marketing folks w/ clue-by-four.
Broam
+2  A: 

Using the AlternateView class, you can specify a text/plain body and provide an alternate html body for the marketing boys. Even if the text part only says that you should have an html enable reader, the spam filter will drop 1.8 points.

Then if you start the HTML message with a proper tag (just take a full html page), you will drop 2.8 poins.

You can also include LinkedResources so you can send the image without showing attachments, much nicer.

GvS
This gave me the most control over the email, whilst the other suggestions were helpful. This one actually provided me with the technical information that I required.
Phil Hannent
+7  A: 

It's already telling you what to do, but I'll spell it out for you:

  1. Include more text or less images.
  2. Nothing you can do here if you want HTML. It's not weighted on the default SpamAssassin install anyway, though.
  3. Add in a text version of the content in addition to the HTML version.
  4. Add in the missing <html> tag
  5. Set up reverse DNS for your outgoing mail server's IP.

Steps 3 and 4 are probably the most important to do. 1 is out of your control (marketing is in control of that). 5 would help, but it's rated fairly low.

R. Bemrose
+2  A: 

If you've simply got an html link to a picture, then it looks like spam, and people who's email clients block images by default (most online ones do) won't be able to see your message.

Rather than have one big image, try breaking it up and use html tables to lay it out. Also, make sure you set the alt attribute on the img tags.

The other thing, apart from the spam assasin score, to look at, is making sure you've set up Sender Policy Framework for the domain from which you're sending the emails. Some online email providers do not score spam on content at all, rather they use SPF and user's "reporting spam", so make sure you get this set up and working correctly before you do large broadcasts.

You might also choose to use a service such as the excellent campaign monitor instead of writing your own broadcast client. They can guide you through the process of setting up the DNS entries required for SPF, and also provide tracking of people opening the email and following links within the email.

David Kemp