Silent conversions are evil

SendGrid e-mail server silently converts plain text e-mails to HTML, losing line breaks in the process. They have some reasoning on why this is a good idea, but I do believe most silent conversions are evil, since they violate the rule of least astonishment.

I have added a plugin to WordPress that sends e-mail notifications to a commentator when their coment is answered (this should have been a standard feature, but that’s another matter). It almost worked: the notifications did arrive, but all squished in one line. So, if the original message was

Line One
Line Two

it would show in the e-mail as “Line One Line Two”.

Something along the way was losing the line breaks, and I had quite a few moving parts in the pipeline: the plugin, the WordPress, PHP, Apache, sendmail on my server, the mail client and any of the SMTP relays in between.

I verified that this is not the plugin, since it sends a plain text e-mail only. After some digging I noticed that the converted HTML e-mail has some embedded image that refers to “Sendgrid”. I host my blog on Azure, and Sendgrid is the mail server they offer. And indeed, it turns out Sendgrid silently converts plain text e-mails to HTML, losing line breaks in the process.

Silent conversions are evil: this is why C++ ended up having the explicit keyword. Silent conversions that lose information are especially evil. Frankly, Sendgrid should not have done it, or at least should have made it an opt-in feature, rather than the default.

4 Comments


  1. Hello, Kane from Sendgrid here. Sorry to hear that you had some troubles with this feature. We recognize that it’s not the best way as we do it right now.
    This feature is controversial as there are many people that support both options. Unfortunately in this situation we might have to maintain status quo.

    Reply

    1. Hi.

      Thank you for reading my blog and responding, this is really awesome! I guess one way out would be to turn the feature off by default for new accounts. This way, if someone relies on it, it will continue to work, but new subscribers won’t be surprised like I was.

      Reply

      1. Yeah, we discussed that possibility. Overall it’s more headache than not, so we might do that, just as always it is too small detail, so it might get lost again. I’ll try to prioritize it some time soon.

        Reply

Leave a Reply to ikriv Cancel reply

Your email address will not be published. Required fields are marked *