This project has moved and is read-only. For the latest updates, please go here.

Change the FeedbackEMailAddress subject and body

Oct 3, 2011 at 10:11 AM

Hello guys, can you please tell me where can I find the method that I need to modify in order to change the Subject and the Body of the email send via the FeedbackEMailAddress link. I am using vs2005 style.

Oct 3, 2011 at 4:07 PM

Add a Resource Item file to the project.  Open the file for editing and locate the items with an ID starting with "fb_" or "feedback".  The ones you need to modify will be amongst them. 



Oct 4, 2011 at 11:19 AM

Thank you for your reply. I have managed to add ResourceItemFile and I have managed to change the body of the emails. However, I did not manage to correct the emails subject. What I want to achieve is to set the subject to the productName + " " + Url to the article. This can be achieved by modifing the SubmitFeedback method in the script_feedBack.js file, however, I would rather do it in the resource file. Here is how my .js file looks like in order to achieve this result:

extractURL = URL
extractURL = extractURL.substring(extractURL.indexOf("html/")+5,extractURL.length);
var subject = product + ". Article name: " +  extractURL;
var customBody = "Please do not change the subject of this e-mail."
location.href = "mailto:" + alias + "?subject=" + subject + "&body=" + customBody + defaultBody;

Oct 4, 2011 at 4:01 PM

If you don't want to change the Sandcastle script files, you can use's SHFB's content override feature.  Add the modified script to your project in a folder called .\Scripts and set it's build action to Content.  When you build the project, it will overwrite the default script from Sandcastle in the help file output.



Oct 10, 2011 at 9:54 AM

Great feature. I have used it to modify the "Send Feedback" (at the top of the page) subject and body, by adding a modified version of the script_feedBack.js file to my documentation project. However, I am not able to find the file that I need to modify in order to change the subject and body of the Send comments on this topic to (at the bottom of the page). Can you point me to the correct file.

Oct 10, 2011 at 4:44 PM

Add a resource items file to the project and edit the content of the "comments" entry to change the text of the "send comments" line in the footer.



Oct 10, 2011 at 5:33 PM

May be I did not express myself correctly. I want to change the SUBJECT and the BODY of the email send from the "Send Comments" link, and not the send comments text itself.

Oct 10, 2011 at 11:26 PM

The answer is the same.  That particular link doesn't supply body text so you'd just have to add it.  By default, it uses the help file title inserted via a substitution tag plus the current topic's title obtained using a little script as the default subject.



Dec 8, 2011 at 2:20 PM

Hello checho_85,
Can you tell me step-by-step instructions on how you did your modification for the Send Feedback as I need to do the same -- subject line and body content of email.


Dec 8, 2011 at 2:50 PM
Edited Dec 8, 2011 at 2:51 PM

To customize the emails body and subject (send feedback and send comments” two files should be modified:

1. To modify the “Send feedback” subject and body modify the “C:\Program Files (x86)\Sandcastle\Presentation\vs2005\Scripts\script_feedBack.js” 

2. To modify the “Send comments…” subject and body modify the “C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\SharedContent\ SharedBuilderContent_en-US.xml” 


Here is a sample of the first file: 

<?xml version="1.0" encoding="utf-8"?><content xml:space="preserve">    <!-- NOTE: This file must appear LAST in the list of content files               so that these items override the matching items in the               stock content files! -->
    <!-- reference_content.xml overrides -->    <item id="rootTopicTitle">{@RootNamespaceTitle}</item>    <item id="rootTopicTitleLocalized">Namespaces</item>    <item id="rootLink"><referenceLink target="R:Project">{@RootNamespaceTitle}</referenceLink></item>    <item id="productTitle">{@HtmlEncHelpTitle}</item>    <item id="runningHeaderText">{@HtmlEncHelpTitle}</item>
    <item id="locationInformation">Assembly: {0} (Module: {1}) Version: {2}</item>    <item id="assemblyNameAndModule">{0} (in {1}.{2}) Version: {3}</item>
    <!-- shared_content.xml overrides -->    <item id="copyCode">Copy</item>
    <item id="locale">{@Locale}</item>
    <item id="preliminary"><p style="color: #dc143c; font-size: 8.5pt; font-weight: bold;">[This is preliminary documentation and is subject to change.]</p></item>
    <item id="comments"><p/>Send comments on this topic to        <a id="HT_MailLink" href="mailto:{@UrlEncFeedbackEMailAddress}?Subject={@UrlEncHelpTitle}&amp;body=">{@HtmlEncFeedbackEMailAddress}</a>        <script type="text/javascript">        var HT_mailLink = document.getElementById('HT_MailLink');        var HT_mailLinkText = HT_mailLink.innerHTML;        var customBody = 'Here you add your custom body\n if you want here is the second line, etc';        var bodyPosition = HT_mailLink.href.lastIndexOf('body');        var bodyContent = HT_mailLink.href.substr(bodyPosition - 1);        var preBodyContent = HT_mailLink.href.substr(0,bodyPosition - 1);        HT_mailLink.href = preBodyContent + ': ' + document.title + bodyContent + encodeURI(customBody);        HT_mailLink.innerHTML = HT_mailLinkText;                </script> </item>
    <!-- To format the copyright HREF and/or copyright text into a message of         your choosing, you can specify @HtmlEncCopyrightHref and/or         @HtmlEncCopyrightText in braces -->    <item id="copyright">{@HtmlEncCopyrightInfo}</item>
    <!-- SHFB Show Missing Component messages -->    <item id="shfbAutoDocConstructor">Initializes a new instance of the &lt;see cref="T:{0}"/&gt; class</item>    <item id="shfbAutoDocStaticConstructor">Initializes the static fields of the &lt;see cref="T:{0}"/&gt; class</item>    <item id="shfbAutoDocDispose">Releases all resources used by the &lt;see cref="T:{0}"/&gt;</item>    <item id="shfbAutoDocDisposeBool">Releases the unmanaged resources used by the &lt;see cref="T:{0}"/&gt; and optionally releases the managed resources</item>    <item id="shfbAutoDocDisposeParam">True to release both managed and unmanaged resources; false to release only unmanaged resources</item>    <item id="shfbMissingTag">&lt;p style="color: #dc143c; font-size: 8.5pt; font-weight: bold;"&gt;[Missing &amp;lt;{0}&amp;gt; documentation for "{1}"]&lt;/p&gt;</item>    <item id="shfbMissingParamTag">&lt;p style="color: #dc143c; font-size: 8.5pt; font-weight: bold;"&gt;[Missing &amp;lt;{0} name="{1}"/&amp;gt; documentation for "{2}"]&lt;/p&gt;</item>    <item id="shfbMissingIncludeTarget">&lt;p style="color: #dc143c; font-size: 8.5pt; font-weight: bold;"&gt;[Missing &amp;lt;include&amp;gt; target documentation in '{0}'.  File: '{1}' Path: '{2}']&lt;/p&gt;</item></content>


And the second file:

//Default FeedBack Valuesvar ratings = 3;var title = document.title;var URL = location.href.replace(location.hash,"");var version = 2007;
/************************************************************************* * Methods ******************************************************** *************************************************************************/
function DeliveryType(){  if (URL.indexOf("ms-help://")!=-1) {return("h");} else if (URL.indexOf(".chm::/")!=-1) {return("c");} else if (URL.indexOf("http://")!=-1) {return("w");} else if (URL.indexOf("file:")!=-1) {return("f");} else return("0");}
function DeliverableValue(deliverable){  if (URL.indexOf("ms-help://")!=-1)  { delvalue  = location.href.slice(0,location.href.lastIndexOf("/html/")); delvalue  = delvalue.slice(delvalue.lastIndexOf("/")+1); return delvalue; } else return(deliverable);}
function URLValue(){ if (URL.indexOf(".chm::")!=-1)  { a = URL; while (a.indexOf("\\") < a.indexOf(".chm::") || a.indexOf("//") > a.indexOf(".chm::"))  { if (a.indexOf("\\")==-1) { break; } a = a.substring(a.indexOf("\\")+1,a.length); } return("ms-its:"+a) } else if (URL.indexOf("file:///")!=-1)  { a = URL;
 b = a.substring(a.lastIndexOf("html")+5,a.length); return("file:///"+b); } else return(URL);}
function GetLanguage(){ var langauge;   if(navigator.userAgent.indexOf("Firefox")!=-1)   {  var index = navigator.userAgent.indexOf('(');    var string = navigator.userAgent.substring(navigator.userAgent.indexOf('('), navigator.userAgent.length);    var splitString = string.split(';');   language = splitString[3].substring(1, splitString[3].length);  }  else language = navigator.systemLanguage; return(language);}

//---Gets topic rating.---function GetRating(){
sRating = "0"; for(var x = 0;x < 5;x++)  { if(document.formRating) { if(document.formRating.fbRating[x].checked) {sRating = x + 1;}} else return sRating;  } return sRating;}
function SubmitFeedback(alias, product, deliverable, productVersion, documentationVersion, defaultBody, defaultSubject){ extractURL = URL extractURL = extractURL.substring(extractURL.indexOf("html/")+5,extractURL.length); var subject = product + ". Article name: " +  document.title;  // + " (" // + "/1:"  // + product  // + "/2:"  // + productVersion  // + "/3:"  // + documentationVersion  // + "/4:"  // + DeliverableValue(deliverable)  // + "/5:"  //+ URLValue()  // + "/6:"  // + GetRating()   // + "/7:"  // + DeliveryType()  // + "/8:"  // + GetLanguage() // + "/9:"  // + version // + ")";  var customBody = "Here you add your custom body."   location.href = "mailto:" + alias + "?subject=" + subject + "&body=" + customBody + defaultBody;}
function AltFeedback(src, title) { src.title = title; return; }


I hope this helps :)

Jul 19, 2012 at 4:10 PM

Would I need to go through all of this just to change the body of the message?

I tried modifying fb_body in the Resource Items, but this does not seem to have any effect.

I have tried vs2005 and vs2010.


Jul 19, 2012 at 7:44 PM

Changing fb_body in a resource item file that you've added to your project is sufficient to change the body text.  However, for the VS2005 style, it depends on which link you click as to whether you see it or not.  If you click the "Send Feedback" link in the header, the body text is used while clicking the link in the footer results in a blank body.  The VS2010 style appears to use the overridden body text for either link.



Jul 20, 2012 at 7:53 AM

There are two links in the vs2005 style - one on the top and one on the bottom. To change the body of both, you need to edit the following files:

C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\SharedContent\SharedBuilderContent_en-US.xml

C:\Program Files (x86)\Sandcastle\Presentation\vs2005\Scripts\script_feedBack.js


In the latter you need to modify the following function;

function SubmitFeedback(alias, product, deliverable, productVersion, documentationVersion, defaultBody, defaultSubject)
	 extractURL = URL
	 extractURL = extractURL.substring(extractURL.indexOf("html/")+5,extractURL.length);
	 var subject = product + ". Article name: " +  document.title;
		var customBody = "Add your body here \r\n blablabla";
		location.href = "mailto:" + alias + "?subject=" + subject + "&body=" + encodeURIComponent(customBody);

In the former the following item:
  <item id="comments"><p/>Send comments on this topic to
        <a id="HT_MailLink" href="mailto:{@UrlEncFeedbackEMailAddress}?Subject={@UrlEncHelpTitle}&amp;body=">{@HtmlEncFeedbackEMailAddress}</a>
        <script type="text/javascript">
        var HT_mailLink = document.getElementById('HT_MailLink');
        var HT_mailLinkText = HT_mailLink.innerHTML;
        var customBody = 'YOUR TEXT HERE';
        var bodyPosition = HT_mailLink.href.lastIndexOf('body');
        var bodyContent = HT_mailLink.href.substr(bodyPosition - 1);
        var preBodyContent = HT_mailLink.href.substr(0,bodyPosition - 1);
        HT_mailLink.href = preBodyContent + ': ' + document.title + bodyContent + encodeURI(customBody);
        HT_mailLink.innerHTML = HT_mailLinkText;
Let me know if these modification does not work for you (I might be missing something) and I will upload sample files.