Missing trailing newline on de-MIMEd mail

John L <[email protected]> Sat, 17 Nov 2007 14:04:36 -0500 (EST)
Newsgroups gmane.mail.majordomo.majordomo2.devel
Message-ID <[email protected]>
I'm getting big buckets of bounces on some de-MIMEd mail from Yahoo
users, in a list set to flatten everything to plain text:

configset ithuu attachment_filters <<ENDAAJ
text/plain | allow
ALL | discard
text/html | format
text/enriched | format
ENDAAJ

The problem is that Yahoo mail sends multipart mail where their tag in the 
formatted part at the end doesn't end in a new-line.  When the message is 
sent to qmail, my MTA, it spits it back, correctly complaining that 
there's no newline at the end as RFC821 requires.  If you don't use qmail, 
you probably haven't noticed this because the SMTP submission used with 
other MTAs adds the newline at the end sort of by accident.

You can argue whether the bug is at Yahoo for sending improperly
formatted mail, or in the demime code for not ensuring that the
decoded stuff is valid, but it's a pain either way.  For now, I've
slapped a band-aid into QQEnvelope.pm that opens the outgoing mail
file, checks the last character, and adds a \n if needed, but that's
gross.

Is there anywhere in the Deliver code where it would be easy to check for 
that trailing newline and add it if need be?  I've looked but the code is 
kind of daunting.

Regards,
John Levine, [email protected], Primary Perpetrator of "The Internet for Dummies",
Information Superhighwayman wanna-be, http://www.johnlevine.com, ex-Mayor
"More Wiener schnitzel, please", said Tom, revealingly.