Email this Topic
What's covered?
How to enable your users to email someone with a link to a topic in the help. There are three methods:
- Email from a text link
- Email from a graphic
- Email from a toolbar button
The text and graphic methods work in RoboHelp but are not dependent on any RoboHelp functionality. In other words they will work from any web page. The toolbar method is of course for RoboHelp only.
Thanks to Roger Nilsson for writing the text and graphic scripts. They both work in IE and Firefox.
Thanks to Sean McGurr and Willam van Weelden for the toolbar method.
Create an email from a text link
Select the code below, then in the true code view of your topic go to the desired location in the body and press Ctrl V. The paragraph tags are only required if you want the link to display on its own line.
In RoboHelp's WYSIWYG view, you will see a red square. It will work when you click your Preview icon.
Change the variables and the "mailto" details to provide the text you want users to see in the email.
****************************************
<p><script type="text/javascript">
var mailSubject = 'Useful Information';
var mailBody = 'This page might help: ' + location.href;
var mailDisplay = 'Click here for a demo.';
document.write(
'<a href="mailto:yourname@yourSite.com'
+ '?subject=' + escape(mailSubject)
+ '&body=' + escape(mailBody)
+ '">' + mailDisplay + '</a>'
);</script></p>
****************************************
Create an email from a graphic
Select the code below, then in the true code view of your topic go to the desired location in the body and press Ctrl V. The paragraph tags are only required if you want the graphic to display on its own line.
In RoboHelp's WYSIWYG view, you will see a red square. It will work when you click your Preview icon.
Change the variables and the "mailto" details to provide the text you want users to see in the email. Also change the name of the image and include its path if necessary using forward slashes. You will also need to add the image to your baggage files.
****************************************
/*
<p><script type="text/javascript">
var mailSubject = 'Useful Information';
var mailBody = 'This page might help: ' + location.href;
var mailDisplay = '<img src="mailto.png" border=0>';
document.write(
'<a href="mailto:yourname@yourSite.com'
+ '?subject=' + escape(mailSubject)
+ '&body=' + escape(mailBody)
+ '">' + mailDisplay + '</a>'
);</script></p>
//*
****************************************
Create an email from the toolbar
Open the skin editor and create a new toolbar button.
In the Text tab enter the Item Name and Text plus any images you require.
Select the code below.
****************************************
window.location=('mailto:someone@theirdomain.com?Subject=Useful Information&body=This page might help: ' + window.parent.frames[1].frames[1].document.title +' ' + escape(window.parent.frames[1].frames[1].document.location))
****************************************
In the Action tab click JavaScript in the Action frame and paste the code into the OnClick field.
OK out of the skin editor and generate your help making sure you select the new toolbar button in the second page of the wizard.
Changing the Script
The script will need to be amended.
window.location=('mailto:someone@theirdomain.com?Subject=Useful Information&body=This page might help: ' + window.parent.frames[1].frames[1].document.title +' You can add additional text here ' + escape(window.parent.frames[1].frames[1].document.location))
The text in red needs to be amended to whatever you need / prefer.
The text in blue can be deleted if you do not want the topic title to be included. Include the single quotes in what you delete.
The text in green can be deleted if you do not want the location of the topic. Do not delete the single quote before the plus sign.
Donations
If you find the information and tutorials on my site save you time figuring it out for yourself and help improve what you produce, please consider making a small donation.