I have a button to send an e-mail message. This opens a new e-mail but the problem is that the subject and the body text are not added to the e-mail message. This is what I have so far that is not working:
<input style="background: #4a5e70; color: #ffffff;" type="button" value="REQUEST INVITE" onclick="window.location.href='mailto:me@any.com’;” subject=“Request%20invite;body=Hallo%20you;”/>
In almost every language (PowerShell is one exception), text strings are delimited by typewriter quotes ('
and "
) not typographic quotes (‘
, ’
, “
or ”
). You should replace your quotes like so:
onclick="window.location.href='mailto:me@any.com?subject=Request%20invite&body=Hallo%20you'"
The onclick
attribute is written as a single string (delimited by double quotes) whose href
whose value is a single string (delimited by single quotes) expressed as a URL-encoded query string.
Note also that you can’t rely on mailto links working unless users have configured a local email client correctly.
See the Mailto Wikipedia article and this related question for more information.