Greeting Meteorites!
According to most the best way to create an html template is with an xhtml transitional doctype. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
(campaignmonitor for example uses that notation for all it’s email templates) For example here’s an article https://www.campaignmonitor.com/blog/email-marketing/2010/11/correct-doctype-to-use-in-html-email/
Only problem is: when using Meteor’s core email package it doesn’t allow me to send an email with a doctype declaration. To be clear - it does work without the doctype declaration - I tried it!
Here is my setup:
- I am storing all my email templates in a top-level private directory.
- I am calling the email.send method server side using the ssr:meteorhacks package to render templates with passed data.
Here is my server side code if you are interested:
Meteor.methods({
'sendEmail':function(){
SSR.compileTemplate('htmlEmail' , Assets.getText('email/trial_ending.html'));
var emailData = {
title: "Trial Ending Soon.",
addCardUrl : "CARDURL",
year : moment().year()
};
Email.send({
to: "anpolchert@gmail.com",
from: "Us<us@example.com>",
subject: "Trial is ending.",
text: "The contents of our email in plain text.",
html: SSR.render('htmlEmail', emailData)
});
}
})
The error I receive is Error: Unexpected Doctype For whatever reason the email package doesn’t seem to recognize any doctype declaration! Anyone know what’s going on here?
Thank you and look forward to a response.
Alex