If I don’t get this off my chest, I’m going to explode.
I’ve spent all day trying to debug this really weird problem in some
code. I’m writing some code to generate HTML emails, for
spam^Wpermission marketing. I’m writing in python on Debian
GNU/Linux.
These emails have a bit of a funny format, where you need to provide
both a text part and an html part. You encode the message as a mime
multipart/alternative email, which tells the mail reader that
receives it that all the parts are equivalent, and to choose the one it
likes most - this means that people with text mail clients (like me) get
the text version automatically, and people with html mail clients (like
outlook) get the html one.
We build the text parts ourselves, since text formatting requires
some special decisions (like long url wrapping and things), so the code
takes seperate text and html parts, bundles them up and sends them.
Anyway, I was sending emails, and what arrived were two parts, text
& HTML, but with the same contents, except the html had been
mysteriously stripped from the html part, if it was used in the text
bit. It was only about 30 lines of code all-told, and I really couldn’t
see any mistakes in it.
So I’ve been laboriously debugging this code all day, probably for
about 5 hours, which is really frustrating. And I can’t find the
problem. I completely rewrite it from scratch using different email
libraries (email instead of MimeWriter for the python people). Still
the same effect. Then I notice that when I just tweak the MIME type of
the mail to multipart/mixed, suddenly my email is good.
It comes to me in a flash. There is a Microsoft Exchange 5.5 server
which acts as our office MTA. All email sent in the office is routed to
that, and then it sends it on. I’ve been reading my email on a remote
machine, so all Exchange has been doing is acting as an MTA. But IT
HAS BEEN REWRITING MY EMAILS. Not just a bit - “oh, i’ll just add a
Received: header”, but it’s been messing with the body of my email!
This is amazingly bad. In fact it’s shit. Even more shit than all the
other shit things about Microsoft software.
I’ve had enough. The Exchange server dies. Within a month we’ll be
running some nice, reliable IMAP server.
Recent Comments