Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use HTML anchors as a table of contents in email when rendered in clients like Groupwise or Gmail?

Tags:

html

email

I would like to put a table of contents at the top of an internal email newsletter that will allow readers to 'jump' down to the part of the newsletter that interests them. Something like:

<ul>
      <li><a href="#FUNDING">Funding Opportunities</a></li>
      <li><a href="#DEVELOPMENT">Professional Development</a></li>
      <li><a href="#BEST">Best Practices</a></li>
</ul>

Then 'further down' in the email newsletter have:

<h2><a id="FUNDING">Funding</a></h2>
<!--- news items about funding -->

<h2><a id="DEVELOPMENT">Professional Development</a></h2>
<!--- news items about professional development -->

<h2><a id="BEST">Best Practices</a></h2>
<!--- news items about Best Practices -->

This works fine in browser based HTML, but I have not had success getting it to work in various email clients (gmail, groupwise, outlook). I have however, received emails that appear to use a technique like above and I am able to 'scroll' the email. I understand that support in various clients will vary and that this is not necessarily a 'good' practice but this is an internal system and almost all recipients will be using GroupWise.

Any experienced insight into the specific additional markup that is needed (e.g. what would the base ref be?) would be greatly appreciated.

like image 325
Brian Avatar asked Jun 25 '09 18:06

Brian


2 Answers

Try adding the 'name' attribute to the anchor as well as the 'id'.

<a id="FUNDING" name="FUNDING">
like image 110
Doug Domeny Avatar answered Nov 15 '22 07:11

Doug Domeny


I found this post when trying to accomplish the same thing, and I followed instructions here to get it to work: http://blog.mailermailer.com/tips-resources/anchor-tags-html-emails

This is the code I ended up with in the first successful test:

<html>
<a name="BACKTOTOP">Index</a>
<ul>
<li><a href="#COMPLIANCE">Compliance Courses</a></li>
<li><a href="#DEALERTRAINING">Dealer Training</a></li>
<li><a href="#FUNCTIONALAREA">Functional Training Courses</a></li>
<br>
<h1>
<a name="COMPLIANCE">Compliance</a>
</h1>
<br>
This will be the message for Compliance courses.
<br>
<a href="#BACKTOTOP">Return to top index</a>
<br>
<h1>
<a name="DEALERTRAINING">Dealer Training</a>
</h1>
<br>
This will be the message for Dealer Training.
<br>
<a href="#BACKTOTOP">Return to top index</a>
<br>
<h1>
<a name="FUNCTIONALAREA">Functional Training Courses</a>
</h1>
<br>
This will be the message for courses by Functional Area.
<br>
<a href="#BACKTOTOP">Return to top index</a>
</html>
like image 44
April Avatar answered Nov 15 '22 08:11

April