Page 1 of 1

mail() + HTML problem

Posted: Mon Apr 02, 2007 3:56 pm
by 696020
I've always understood the mail() function just fine, but lately I've gotten reports that the emails I'm generating are coming into people's mailboxes with gobbeldygook (see http://andrewniesen.com/email_problem.gif)...

I've never been able to replicate this issue myself, but get persistent reports. Is it a header problem?

Here is my current source with raw headers:


Code: Select all

Return-Path: <nobody@z09528AA.textdrive.com>
X-Original-To: niesen@chilco.textdrive.com
Delivered-To: niesen@chilco.textdrive.com
Received: from localhost (unknown [10.0.0.214])
	by chilco.textdrive.com (Postfix) with ESMTP id D8E32DC99E
	for <niesen@chilco.textdrive.com>; Mon,  2 Apr 2007 16:17:25 +0000 (UTC)
X-Spam-Score: 2.153
X-Spam-Level: **
X-Spam-Status: No, score=2.153 tagged_above=-999 required=5
	tests=[HTML_IMAGE_ONLY_12=1.639, HTML_MESSAGE=0.001,
	HTML_MIME_NO_HTML_TAG=0.512, MIME_HTML_ONLY=0.001]
Received: from chilco.textdrive.com ([10.0.0.242])
	by localhost (mailscan1.textdrive.com [10.0.0.214]) (amavisd-new, port 10024)
	with ESMTP id jreEk4+mo99H for <niesen@chilco.textdrive.com>;
	Mon,  2 Apr 2007 16:17:34 +0000 (GMT)
Received: from pendrell.textdrive.com (pendrell.textdrive.com [207.7.108.149])
	by chilco.textdrive.com (Postfix) with ESMTP id 45162DC95A
	for <andrew@andrewniesen.com>; Mon,  2 Apr 2007 16:17:24 +0000 (UTC)
Received: by pendrell.textdrive.com (Postfix)
	id 8E62CBC79D; Mon,  2 Apr 2007 16:17:24 +0000 (GMT)
Delivered-To: andrew@pendrell.textdrive.com
Received: from localhost (unknown [10.0.0.214])
	by pendrell.textdrive.com (Postfix) with ESMTP id 692B6BC77B
	for <andrew@pendrell.textdrive.com>; Mon,  2 Apr 2007 16:17:24 +0000 (GMT)
Received: from pendrell.textdrive.com ([10.0.0.149])
	by localhost (mailscan1.textdrive.com [10.0.0.214]) (amavisd-new, port 10024)
	with ESMTP id auOx2LJE+Tsm for <andrew@pendrell.textdrive.com>;
	Mon,  2 Apr 2007 16:17:32 +0000 (GMT)
Received: from z09528AA.textdrive.com (unknown [8.7.217.114])
	by pendrell.textdrive.com (Postfix) with ESMTP id 87824BC764
	for <info@theorangeblock.com>; Mon,  2 Apr 2007 16:17:23 +0000 (GMT)
Received: by z09528AA.textdrive.com (Postfix, from userid 60001)
	id BAC2011BE0; Mon,  2 Apr 2007 09:17:22 -0700 (PDT)
To: miked@harris-pub.com
Subject: Invoice ORB2007040201: Due in 30 days
From: theorangeblock.com <info@theorangeblock.com>
Reply-To: theorangeblock.com <info@theorangeblock.com>
MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bitCc: 
Message-Id: <20070402161722.BAC2011BE0@z09528AA.textdrive.com>
Date: Mon,  2 Apr 2007 09:17:22 -0700 (PDT)




<center><TABLE WIDTH="400" style="font-family: arial; font-size: 12px;">
<TR><TD align="center" colspan="2"><img src="http://www.shootq.com/gfx/company/resize.php?image=3_JH89JA.jpg&size=200" alt="theorangeblock.com"></TD></TR>
<TR><TD align="right"><b>Invoice For:</b></TD><TD>Mike Delfin</TD></TR>
<TR><TD align="right"><b>Invoice Number:</b></TD><TD>ORB2007040201</TD></TR>
<TR><TD align="right"><b>Amount:</b></TD><TD>$1336.36</TD></TR>
<TR><TD align="right"><b>Invoice Date:</b></TD><TD>April 2, 2007</TD></TR>
<TR><TD align="right"><b>Date Due:</b></TD><TD>May 2, 2007</TD></TR>
<TR><TD align="right"><b>Status:</b></TD><TD>Due in 30 days</TD></TR>
<TR><TD align="right"><b>Printable Copy:</b></TD><TD><a href="http://www.shootq.com/store/invoice_print.php?invoice_number=ORB2007040201&invoice_ID=2055" target="_BLANK">Click Here</a></TD></TR>
<TR><TD align="right"><b>Pay Online:</b></TD><TD><a href="http://www.shootq.com/store/consumer_creditcard.php?invoice_number=ORB2007040201&invoice_ID=2055" target="_BLANK">Click Here</a></TD></TR>
</TABLE>
Any suggestions on improvement would be very helpful! Thanks!

Posted: Mon Apr 02, 2007 4:18 pm
by Chris Corbyn

Code: Select all

Content-Transfer-Encoding: 8bitCc:
Missing a new line:

Code: Select all

Content-Transfer-Encoding: 8bit
Cc:

Posted: Mon Apr 02, 2007 4:35 pm
by 696020
Duh...thanks! Why didn't I see that? We'll see if that fixes the problem.

If anyone else sees anything that could be a problem, please don't be shy. Also, I'm wondering how I might get that spam score down a bit...

Posted: Mon Apr 02, 2007 5:03 pm
by Chris Corbyn
696020 wrote:Duh...thanks! Why didn't I see that? We'll see if that fixes the problem.

If anyone else sees anything that could be a problem, please don't be shy. Also, I'm wondering how I might get that spam score down a bit...
Using Swift Mailer will essentially give the sort of spam score you'd get from using Thunderbird or another RFC compliant mail client.

http://www.swiftmailer.org/

However, you'll need to be a bit more elegant about what you send. You're sending an image and nothing more. This is a HUGE spam technique and it's where all your points are coming from. If you sent a plain-text part and a HTML part (i.e. a multipart message) and got rid of the big image (why are you doing that anyway when you have HTML to play with?) then you'd be doing a lot better. They've also penalized you for leaving out the <html> tags.

EDIT | Upon closer inspection, it appears your image is probably just a logo. SpamAssassin thinks otherwise because there's barely any other content to dilute it.

Posted: Mon Apr 02, 2007 5:30 pm
by 696020
Thanks for the info. I'll add the HTML tags.

This is an eInvoice-system; the logo is pretty essential. Any other ideas on how to lower the spam score.

Thanks again.

Posted: Mon Apr 02, 2007 5:33 pm
by Chris Corbyn
Everything I said. Adding <html> tags isn't going to do much, making it multipart would do a lot more, and this is a good accessibility technique anyway. SA is seeing the <img > tag taking a pretty big portion of the overall message body. "Fluff" up the other content a bit.

EDIT | You're on the last category for the image thing. More than 1200 bytes of text outside the <img> tag and you're ok.
SA description wrote:-describe HTML_IMAGE_ONLY_12 HTML: images with 1000-1200 bytes of words