Sunday, 25 January 2009

Missing Space in email Subject line - was it SMTP at fault?

A bizarre problem today - logged here just in case it helps anyone else.

Emails generated by PHP and sent via SMTP were losing a space in the subject line. If I wrote "Mailing Labels for John Geddes (1 label)", the last bit would come across as "(1label).

I tested the character string I was sending character by character - no spurious characters. I tried everything, eventually sending the same message seven times in a loop.

The result was clear - but odd. My ISP's spam software gave three of the messages a score of 3.82 - these were fine. Four messages got a score of 3.819 - that extra precision increased the length of the subject line to 69 (including the spam score) at which point it decided to truncate the string, not by lopping off from the end (which would have been obvious) but by removing the final space character.

This cost me an hour and a half - hope the note might just save someone else from wasting as much time.

No comments: