Attachments missing with altermime and postfix

We recently experienced a problem with attachments going missing when using altermime to add a disclaimer to emails. The problem was only evident when the client was Outlook or Entourage (mange tout Rodney, mange tout). It was a real head scratcher as some emails would go through fine, others would be oddly truncated.

I even resorted to ‘catting’ out the email to file before and after applying the disclaimer, and then running diff on the resulting pair of files, but there was apparently no difference bar of course the added disclaimer text.

After protracted googling by myself and a colleague, we found that the Microsoft clients, when parsing the emails prior to sending (which all clients do to chop the lines down to the RFC specified length) allow single full stops to appear by themselves on their own lines. Now Postfix handles these fine when the email comes in over SMTP. However, when it comes out of the disclaimer script, it is injected back into the mail queue with the sendmail command. Seems that this sees the full stop and accepts it as the end of the email, thereby neatly truncating it sans attachment and often without some of the text.

To get around this, we added a single line to the disclaimer script, just prior to the sendmail command:

sed -i 's/^\.$/. /g' in.$$

where in.$$ is the mail. This adds a single space after the full stop which gets around the problem. I hope this saves someone a few hours.

Edit: After spotting a comment on howtoforge, it seems there’s a flag you can set for sendmail to stop it seeing single dots as EOF:

-i Ignore dots alone on lines by themselves in incoming mes-
sages. This should be set if you are reading data from a

which is a lot neater than the fix above. Just sendmail -i in.$$

imap sent or sent items?

Imap rocks, especially since Thunderbird 3.0 and its smart folders allow all email accounts to look like local folders. Emails can be left on the server, where proper backups can be configured, and emails can be accessed from any number of devices and clients, including webmail. Having to nip home to check email is just so 1990s.

It’s not all jolly jolly however. Outlook hasn’t yet followed Thunderbird’s lead – each additional imap account means another sheaf of folders to watch for new mail. But the most irritating aspect of everywhere email with multiple clients is the lack of standardisation of folder names. Oh yes, there’s always an INBOX. But schizophrenia sets in around the Deleted Items folder, which likes to be Trash now and then. And that email I just dispatched – was it Sent? Or a Sent Item? I’m sure we all agree that Spam is also Junk, but at the risk of being accused of folderism, c’mon, won’t one folder do?

Having the ability to create folders that are instantly available to all my clients is great, truly. But the default four – Inbox, Sent, Trash and Junk – please let us all agree on these. I for one don’t want seven folders for each account where four will do.