8

I want to open the mail client of the user with a specific text. Some parts of the text should be bold, italic or u̲n̲d̲e̲r̲l̲i̲n̲e̲d̲.

I tried this by using mailto

But it use the RFC 2368... so this is not possible at all:

The special hname "body" indicates that the associated hvalue is the body of the message. The "body" hname should contain the content for the first text/plain body part of the message. The mailto URL is primarily intended for generation of short text messages that are actually the content of automatic processing (such as "subscribe" messages for mailing lists), not general MIME bodies.

Is there any other way to proceed to open the mail client with a specific formated template ?

AsgarAli
  • 2,201
  • 1
  • 20
  • 32
Atnaize
  • 1,766
  • 5
  • 25
  • 54
  • 3
    Not possible. See http://stackoverflow.com/questions/5620324/mailto-with-html-body – FLX Oct 05 '15 at 12:43
  • @FLX I know that is not possible with `mailto`, my question is : Is there another option ? – Atnaize Oct 06 '15 at 12:21
  • No other options using mailto. Best way to send HTML mails is to use phpmailer or something like that. You could make it send a mail from your user's adress – FLX Oct 06 '15 at 13:02

1 Answers1

3

⚠ Do not use this unless you know your audience and have verified this does no harm to anybody.

And even then better refrain from using it, since it is more misuse than anything else: such content is mostly not accessible for assistive technology.


Since your question already includes "faux underline" (u̲n̲d̲e̲r̲l̲i̲n̲e̲) (mis)using combining low line character (Wiki),you probably know about other "faux alphabets", "twitter fonts" and similar shenanigans misusing other Unicode features, mostly various mathematical notations. With this dark knowledge you can just use proper URI encoding and browsers should pass the content to e-mail clients just fine:

var str = 'Please do not abuse "", "u̲n̲d̲e̲r̲l̲i̲n̲e̲", "" and other mathematical notations glyphs for ❝formatting❞.\nThanks!';
var href = 'mailto:?body=' + encodeURIComponent(str);
document.write((str + ' → ' + href).link(href));

Clicking resulting link produces this in gMail:

gmail compose window with textual abomination from the snippet

and generally should work in any other e-mail client. But again, test thoroughly and do not use if not absolutely necessary.

myf
  • 9,874
  • 2
  • 37
  • 49