Email link becomes inactive when email addresses has leading _ (underscore)
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.
- Go to > General Configuration > User Macros
- Choose Create a User Macro
- Enter the details
- Macro Name (e.g. leading-underscore-email)
- Macro Title (e.g. Leading Underscore Email)
- Set the Definition of User Macro to No macro body
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>
- Go to a page and add the newly created macro
- Enter the email address
- Click Insert
- Save the page and verify the link works