The following javascript code successfully sends an email message via the Gmail API. However the table formatting, specifically the table and column (cell) width settings, seem to be ignored.
function sendMail(email) {
var to = email;
var subject = "HTML formatted email";
var content = "";
content += "<html><body>";
content += "<table width='100%'><tr><td>"; // Outer table
content += "<table width='60%'>"; // Nested table
content += "<tr><td width='70%'>This is a row</td><td width='30%'>999999</td></tr>";
content += "<tr><td width='70%'>So is this</td><td width='30%'>9999</td></tr>";
content += "</table>";
content += "</td></tr></table>";
content += "</body></html>";
var email =
"From: 'me'\r\n" +
"To: " + to + "\r\n" +
"Subject: " + subject + "\r\n" +
"Content-Type: text/html; charset=utf-8\r\n" +
"Content-Transfer-Encoding: quoted-printable\r\n\r\n" +
content;
var base64EncodedEmail = window.btoa(email).replace(/\+/g, "-").replace(/\//g, "_");
var request = gapi.client.gmail.users.messages.send({
"userId": "me",
"resource": {
"raw": base64EncodedEmail
}
});
request.execute();
}
The email message looks as follows:
This is a row 999999
So is this 9999
Everything I've researched on sending HTML formatted email messages says to use nested tables and inline styling. Why is my width styling not working?
%sign.width='400'should do the trick.