I'm trying to create an email link where the link of the email opens a new message with both the subject and body of the email completed?
I can only get the subject, but can't figure out how to get some text in the body of the email.
I've searched online for the code, and have added it in the text editor, but no of what I tried works.
Any suggestions?
email link with body of email
-
- Propeller Head
- Posts: 29
- Joined: Fri Jun 27, 2014 7:51 am
Re: email link with body of email
A "mailto:" JavaScript file (which we called feedback_script.js) worked for us. The link in each topic or in a master page would look like this in the code:
The contents of feedback_script.js would look like this:
The location.href pulls your topic's file name. The mailto: address would be a dedicated email address for receiving all comments.
Hope this helps
Code: Select all
<script src="feedback_script.js" language="javascript" type="text/javascript" xmlns="http://www.w3.org/1999/xhtml"></script>
Code: Select all
var mailSubject = 'Your Subject Line;
var mailBody = '[Enter comments here] \n\nMy comments apply to this page: ' + location.href;
var mailDisplay = 'Feedback on this page';
document.write(
'<a href="mailto:yourdocteam@yourdomain.com'
+ '?subject=' + escape(mailSubject)
+ '&body=' + escape(mailBody)
+ '">' + mailDisplay + '</a>');
Hope this helps
Leon
formerly User crdmerge and crdmerge2
formerly User crdmerge and crdmerge2
Re: email link with body of email
Thanks, I was hoping that there was some non-js way of doing this, since I have zero js experience.
I'll work with this and try to figure it out.
I'll work with this and try to figure it out.
Re: email link with body of email
You have to ensure there are absolutely no spaces in your <a href> code - use %20 instead for spaces, and %0D for new lines. This coding worked for me:Thanks, I was hoping that there was some non-js way of doing this, since I have zero js experience.
<a href="mailto:support@yourcompany.com?subject=This%20is%20the%20Subject&Body=Hello,%0DMy%20account%20username%20is:%0DPlease%20suspend%20the%20following%20sub-accounts:%0D%0D%0D%0D%0DI%20understand%20that%20Service%20Charges%20will%20continue%20for%20these%20sub-accounts.%0DPlease%20reply%20to%20this%20email%20to%20notify%20me%20when%20the%20sub-accounts%20are%20suspended.%0D%0DKind%20regards,%0D%0D">Your link text</a>