In Joomla 3.x the system generates a few page-function icons for an article, including a 'Print' and an 'Email' icon. I would like to include the 'Email' link in other places in the content of an article. Is there an API call I can use to generate the URL/anchor that will do the same thing as clicking the icon would do? Ie. Pop-up the 'Email this page' screen?

Just for clarity this article discusses the functionality I am interested in duplicating.

Thanks for any help!

3 Answers 3


It's a simple link with a window.open in the onclick event to open the mailto component in a new window, this is the html:

<a href="index.php?option=com_mailto&view=mailto&tmpl=component&link=d737962d86ca78bb2e67d29195a13bf03d55a274" title="e-mail" onclick="window.open(this.href,'win2','width=400,height=350,menubar=yes,resizable=yes'); return false;"><span class="icon-envelope"></span> e-mail</a>

The problem here is the mandatory link variable in the href, it's the article link hashed by the mailto component helper, I think the only way to achieve this will be a content plugin with the ability to replace something like {email}your anchor{/email} with the above code using the mailto helper inside the plugin to hash the article link.

  • Thanks for the bread crumbs, @Kim! Yes, the article mailto hash is what I'm trying to figure out how to generate. Any ideas?
    – reor
    Mar 21, 2015 at 9:44
  • components/com_content/helpers/icon.php contains the call - find "static function email"
    – iamrobert
    Jun 18, 2015 at 14:56
  1. Joomla has the option of setting it as text: https://docs.joomla.org/Article_email_and_print_icon_settings

  2. You can do a template override of components/article/tmpl/default.php

  3. Look for this code around line 42:

        <?php if ($canEdit ||  $params->get('show_print_icon') || $params->get('show_email_icon')) : ?>
    <ul class="actions">
    <?php if (!$this->print) : ?>
        <?php if ($params->get('show_print_icon')) : ?>
            <li class="print-icon">
            <?php echo JHtml::_('icon.print_popup',  $this->item, $params); ?></li><?php endif; ?><?php if ($params->get('show_email_icon')) : ?>
            <li class="email-icon">
            <?php echo JHtml::_('icon.email',  $this->item, $params); ?>
        <?php endif; ?>
        <?php if ($canEdit) : ?>
            <li class="edit-icon">
            <?php echo JHtml::_('icon.edit', $this->item, $params); ?>
        <?php endif; ?>
    <?php else : ?>
        <?php echo JHtml::_('icon.print_screen',  $this->item, $params); ?>
    <?php endif; ?>
  4. that what you need to edit:

        <?php if ($params->get('show_email_icon')) : ?>
        <div class="your-class">
        <?php if ($params->get('show_email_icon')) : ?>
        <p><?php echo JHtml::_('icon.email',  $this->item, $params); ?></p>
        <?php endif; ?>
        <?php endif; ?>

You can put this anywhere in your content.

  1. Another alternative would be use to an email the page module: http://extensions.joomla.org/extension/mail-this-page


  1. http://www.addthis.com/

In Joomla 3.x, from the template file, you could

JLoader::register('MailtoHelper', JPATH_SITE . '/components/com_mailto/helpers/mailto.php');

$text      = "Email this to a friend";
$uri      = JUri::getInstance();
$base     = $uri->toString(array('scheme', 'host', 'port'));
$template = JFactory::getApplication()->getTemplate();
$link     = $base . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language), false);
$url      = 'index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailtoHelper::addLink($link);

$status = 'width=400,height=350,top=400,left=400,menubar=yes,resizable=yes';

$attribs['title']   = JText::_('JGLOBAL_EMAIL_TITLE');
$attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
$attribs['rel']     = 'nofollow';

$emailToLink = JHtml::_('link', JRoute::_($url), $text, $attribs);

The $emailToLink renders:

<a href="/component/mailto/?tmpl=component&amp;template=blank&amp;link=00138c314c7fbaee1454db9236c92cab1b78bd03" title="Email this link to a friend" onclick="window.open(this.href,'win2','width=400,height=350,menubar=yes,resizable=yes'); return false;" rel="nofollow">Email this to a friend</a>

Then you need to figure out how to embed this into your article. Maybe some javascript for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.