5

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Dan
  • 2,304
  • 6
  • 42
  • 69

1 Answers1

4

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.

Julian H. Lam
  • 25,501
  • 13
  • 46
  • 73
  • Do you know if there is an example of how to get a table style effect whilst passing data in plain text form? The idea is to get a basic trace route table to appear as a table in plain text. Somehow detect the number of characters in the IP address and subtract that from a pre-determined amount of spaces and then add the spaces after the IP address to take the effect of a table? – Dan Apr 19 '13 at 21:17
  • That'd be difficult, since you cannot guarantee that the user's mail program would interpret your mail body as monospaced text (meaning even calculating the spaces would be pointless). Best bet would just be to host the traceroute results online and have the user visit a website that'll render it quickly in a `
    ` block.
    – Julian H. Lam Apr 19 '13 at 21:22