'Message body empty' - emails not sending/are blank

Before I start, I checked this issue and the links associated with it. This more specific issue was closed with no indication of a resolution (I know it was a duplicate but the issue didn’t seem quite the same to me), so I’m not sure what’s up :frowning:

Here’s the problem: I paste in my email HTML and it shows in the preview, but when I go to save it it disappears. I tried directly putting the HTML into the template via the database entry and whilst it obviously saved with no issues and shows up in the database, it doesn’t show up when I go to send an email.

If I manually paste in the HTML during sending an email then - again - the preview shows up correctly but when I hit ‘send’ I get the ‘message body empty’ error.

I’ve tried manually sending my email and it’s come out fine. I’m using a pretty common boilerplate, and I was even sure to run it through two separate email specific syntax checkers to ensure that wasn’t the problem.

I’m running 1.4.6.

Great application apart from this one issue - thanks!

You can view the email I’m trying to send here.

Threw it into a couple of HTML validators and ‘fixed’ some stuff (i.e. replaced a bunch of my redundancies for IE/Outlook etc.) and it’s now parsing, but a lot of the formatting is understandably broken.

I’m going to do a lot of trial and error to try and find what’s not validating properly. If is possible to see a log on this? application/logs doesn’t show anything.

Well, the only validator to strip back enough markup to make it work is the W3 one: https://validator.w3.org/ (using HTML-Tidy).

I can’t put my finger on what it’s removing because it’s just stripping out so much that a lot of formatting it broken - the buttons, a great deal of the ‘if’ statements and some of the inline CSS too. There must be something in there that Invoice Plane just isn’t happy with. It takes about 5-10 seconds even with the ‘clean’ HTML so clearly it’s checking for formatting or is it purely parsing the { } variables?

Either way, if I could find a log then this would probably be quite easy to find out. Might just be one section, might be the header, buttons or if statements. Having tried removing various parts myself I’ve not been able to make it work though.

I do have debug mode turned on and I’ve checked the console whilst sending an email too just to be sure.

Ok, I’ve made some progress. Seems the email sends, but it hates inline CSS - which I’d understand if this wasn’t an email (where inline CSS is basically standard practice).

Using a cheap and dirty CSS extractor I made it work fine, but it’s messy and I’ll likely end up rewriting the whole thing. It’s a little annoying that it has issues with inline CSS though because a lot of older email clients do prefer it a lot over actual clean and properly formatted HTML, so yeh.

Here’s the file with the CSS extracted and added at the top of the document.