Email link becomes inactive when email addresses has leading _ (underscore)

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

   

Summary

The mailto: markup doesn't render the email link properly when it has a leading underscore, eg. _email@example.com. It results in the link becoming inactive.

Cause

Confluence doesn't escape the _ (underscore) character because it's a reserved character. 

Solution

 We can achieve this using User Macro.

  1. Go to    > General Configuration > User Macros
  2. Choose Create a User Macro
  3. Enter the details
    • Macro Name (e.g. leading-underscore-email)
    • Macro Title (e.g. Leading Underscore Email)
  4. Set the Definition of User Macro to No macro body
  5. In the template section enter the following:

    ## @param Email:title=Email Address|type=string|required=ture|desc=Enter email address 
    <a href="mailto:$!paramEmail">$!paramEmail</a>
  6. Go to a page and add the newly created macro
  7. Enter the email address
  8. Click Insert
  9. Save the page and verify the link works



Last modified on May 2, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.