I didn't find the replies in the linked forum threads very helpful.
Note that when you set up a notification for a Toolset Form, you are only editing the email body. You cannot directly edit the email head, so adding doctype declarations that belong in the head are meaningless.
You cannot link to external stylesheets, and should include the styles for your emails within the body, inside style tags.
The problem is that Forms automatically adds p tags to the notification body. I've tried to find a way to disable them, but cannot.
There is a shortcode you can use to not add auto paragraphs, namely wpv-noautop. Wrapping the entire notification with that shortcode prevents p tags being added automatically within, but the entire notification body is still added inside one single p tag.
So my workaround is to being the notification by closing that p tag, then using the wpv-noautop shortcode to prevent the auto-paragraphs, and at the very end opening a new p tag (because the notification will be followed by a closing p tag).
So I'm able to add styling to the notifications like so:
</p>
[wpv-noautop]
<style type="text/css">
.red {
color: red;
}
</style>
<p class="red">New thing submitted.</p>
<p class="not-red">This looks like an HTML editor but uses auto-paragraphs.</p>
[/wpv-noautop]
I can still use paragraphs outside the wpv-noautop shortcode.
So this will be on a new line.
<p>
I've tested the code in 'Email on acid' and it works for many clients. BUT it's not working when you view those styled mails in gmail (very important client). See hidden link (bullet 4) and screenshot.
is there a way to adjust the <head> and <body> of that HTML mail via functions.php?
In that case I think you are going to have to limit yourself to inline styles (which I believe is the safest technique for cross-client compatibility in any case).
So more like...
</p>
[wpv-noautop]
<p style="color: red">New thing submitted.</p>
<p style="color: yellow">This looks like an HTML editor but uses auto-paragraphs.</p>
[/wpv-noautop]
I can still use paragraphs outside the wpv-noautop shortcode.
So this will be on a new line.
<p>
I have created an internal request to have an option to disable auto-paragraphs on the notification body, but until that is implemented I don't believe you can include a full HTML document as the body (with doctype declaration, head and body) because it is not possible to start with at least one p tag and the doctype declaration would need to be the very first line.
You could try it and see, but email clients tend to be very particular and while it might work in some clients I imagine it could break others.