0

Im developing a mobile application using PhoneGap. In this application the user should be able to click a link to send an email from there and this email should contain HTML data. So what I have is something like this:

JS:

var mail = "<html><body><h1>Testing HTML Email</h1></body></html>"
$("#mailTo").attr("href", "mailto:?subject=Star&body=" + mail);

HTML (PhoneGap):

<a id="mailTo" href="#">Email</a>

When I click the link, the Gmail app on my phone (Im using android) opens with the content of the variable mail but it is not interpreted as HTML. I would like to know if there is a way to do so (set headers or something like that). Thanks in advance.

João Menighin
  • 3,083
  • 6
  • 38
  • 80
  • 1
    [This thread](http://stackoverflow.com/questions/5620324/mailto-with-html-body) suggests it's generally not possible, though some email clients may support a subset of HTML tags. – Keith May 14 '14 at 18:50
  • You should also try URL-encoding your `mail` parameter. – Keith May 14 '14 at 18:51
  • You can use this https://stackoverflow.com/questions/10172499/mailto-using-javascript – Stephen Ngethe Feb 09 '18 at 23:50

1 Answers1

2

No, according to the specification the body is meant to be text/plain:

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.

https://www.rfc-editor.org/rfc/rfc2368

Community
  • 1
  • 1
jgillich
  • 71,459
  • 6
  • 57
  • 85
  • Humm thanks... Any ideas on how I should proceed then? Send the data to a server through HTTP request and then from the server send the email maybe? – João Menighin May 14 '14 at 18:56
  • 1
    @JoãoMenighin Sure that would be a good solution. To get similar results your could then set the `reply-to` header so that replies go to the user that "sent" the email. – jgillich May 15 '14 at 08:00