Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an HTML table in Javascript for use in an email?

I read a post that was 4 years old stating it's not possible to pass HTML to an email body.

I would like to know if this is still true?

My current JavaScript is:

 TableF = '<table style="font-size: 1.0em; border-collapse: collapse;">';
        TableF += '<tr>';
        TableF += '<td>IP Addresses</td>';
        TableF += '<td>Hop Number</td>';
        TableF += '<td>Average MS</td>';
        TableF += '</tr>';
        TableF += '<tr>';
        for(var i = 0; i < iparray.length; i++){
        TableF +=  '<td>'+ iparray[i]+'</td><td>' + hopnum[i]+'</td><td>' + msarray[i]+'</td>';
        }
        TableF += '</tr></table>';
}

And suffice to say this doesn't convert to a table when a mailto link is used, it simply writes the HTML as plain text.

like image 408
Dan James Palmer Avatar asked Oct 05 '22 08:10

Dan James Palmer


1 Answers

You cannot specify HTML content to be passed to a mail application using a mailto link, since it is the "lowest common denominator" of email pre-filling.

The information would be passed to the client's mail program (whether it is outlook, gmail, thunderbird, etc), which is completely out of your control.

Even if it was possible, it would need to be implemented on the client side (the mail program), and not your mailto link.

like image 57
Julian H. Lam Avatar answered Oct 11 '22 14:10

Julian H. Lam