Reputation: 11
I am trying to create an email that requests approval. The way it currently works is that the user needs to reply to the existing email and type "APPROVE" OR "REJECT" as the first word of the body of the email.
Instead, I would like to create two buttons: "APPROVE" and "REJECT"
These buttons need to create a new email message with the appropriate title and body.
I know how to create the email, the only part I am missing is how can I grab the subject of the original email and use it in the subject of the new reply email?
I need this to work in the following email clients:
Upvotes: 0
Views: 849
Reputation: 1
The below schema's work on the iPad, iTouch, outlook, gmail but NOT in "gmail in the browser" on the iPad. :(
You can do some basic html in the email no javascript so far.
Dear _______,
<br/>
<a href="mailto:[email protected]?subject=tokenbbb=this is the body">APPROVE</a>
<br/>
<a href="mailto:[email protected]?subject=my+subb&body=this is the body">REJECT</a>
Sincerely,
<br/>
If you mail the above to the client I believe everything will work for you.
Upvotes: 0
Reputation: 61793
JavaScript is not the appropriate way to accomplish this. Most email clients will prevent JS from executing. I suggest having two links in the email (maybe styled as buttons) so that the user can click "Approve" or "Deny". The links would be handled by some server-side code.
Alternatively, if you still want to send another email, you could use mailto
in the anchor tag and utilize the body
and subject
parameters.
Upvotes: 2
Reputation: 890
You don't need javascript for that. Use mailto:
links instead:
<a href="mailto:[email protected]?subject=<YOUR SUBJECT>&body=<YOUR BODY>">
Here's the full syntax decription.
Good luck!
Upvotes: 2