Period(s)

Last week, a single period drove me nuts.

I’m in the final stages of development of an iPhone App. One of the important features of the app is to send a monthly report in PDF form by e-mail. Up until about two weeks ago, it went flawlessly. Then the attachments were broken, some of the periods in it were replaced by two periods. I did’t change the code but updated iOS so my initial suspect was iOS. Especially since the problem was easily reproduced with a very minimal test application.

I sent the test app to a friend developer and asked for confirmation. He did not see the problem. So, the problem is not in my code and it isn’t in iOS either. Who’s suspicious now? My guess: My iPhone’s settings.

To verify that, I restored the phone to factory settings. Guess what: It didn’t work with factory defaults. One more suspect proven innocent.

I started to think about the chain of tools involved: My app creates the message and calls iOS to send the message. iOS sends the message to my SMTP server (postfix). Since the outgoing SMTP is the SMTP that handles all mails sent to my domain, it directly forwards the mail to SpamAssassin that forwards it to sendmail for delivery to the target mailbox. Once the mail is in my mailbox, dovecot provides it for download over POP3/IMAP.

All my mail clients (Thunderbird, mutt and RoundCubeMail) showed the problem, so I quickly ruled out the mail client. Mutt directly accesses the mailbox, without downloading it through dovecot, so dovecot can not be the problem.

So the problem has to be the SMTP server or the SPAM filter. Both tools are very wide spread and I did not find any hint about the problem I saw. I started to check the configuration again (and again and again). After reading /etc/postfix/master.cf for the 10th time, a single period caught my interest:

spamassassin unix -     n       n       -       -       pipe
    flags=Rq. user=spamd argv=/usr/bin/postfixfilter -f$sender -- $recipient

Can you spot it? There’s a single period at the end of the “flags” argument. I took a look at the man page of postfix’s pipe command where it states in the section about flags:

              .      Prepend "." to lines starting with ".". This is needed by, for example, BSMTP software.

There it is. My problem. A single period in the configuration.