Closed Gaia-Nutrition closed 4 years ago
This could have also been the cause for https://github.com/spatie/mailcoach-support/issues/56
This has been fixed in the latest version.
Hello, can you tell my why mailcoach remove the doctype tag?
My html html begins with <!doctype html>
and the layout works perfectly with the "Test your email first" function.
Once that the campaign is sent, this tag is removed and the final email html contains <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
. At that moment, my template is not responsive at all.
I use Mailcoach 2.15.5.
Is it the expected behavior?
Add @electronick86 could you open a new PR for this? Please include the html that you are using.
Html content for my campaigns is generated by rendering Mailables.
The
ensureEmailHtmlHasSingleRootElement
inside thePrepareEmailHtmlAction
class wrongly assumes a missing<html>
opening tag as the html content starts with<!DOCTYPE ...
. It then adds another opening<html>
tag (but not a closing one as that exists). This results inConvertHtmlToTextAction
to fail due to misplaced DOCTYPE (so no text content is being generated for the campaign).My current workaround for the
ensureEmailHtmlHasSingleRootElement
function (you could probably come up with something more robust):