Blog, Website & Page Publishing

danielruch
Participant

Encrypted mailto Link

SOLVE

Hi everybody

 

I need a solution how a mailto link in Hubspot CMS can be used encrypted, so that no crawlers can read the mail address.

 

Any idea how this could be implemented?

Thanks in andcance,

best, daniel

0 Upvotes
1 Accepted solution
evaldas
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Encrypted mailto Link

SOLVE

Hi @danielruch 

 

You can try and encode the email address and add it after the "mailto:" in the href

 

That can be done either through javascript or you can use an online tool like this:

https://mothereff.in/html-entities

 

Which will convert this: example@email.com

 

into this:

 

 

example@email.com

 

 

Then you simply update your href to:

 

 

<a href="mailto:&#x65;&#x78;&#x61;&#x6D;&#x70;&#x6C;&#x65;&#x40;&#x65;&#x6D;&#x61;&#x69;&#x6C;&#x2E;&#x63;&#x6F;&#x6D;">Link to encoded email</a>

 

 

However, this is not guaranteed to prevent crawlers from indexing it.

 

A better option would be to create a HubSpot form, which will not display email addresses of the recipients.

 


✔️ Did this post help answer your query? Help the community by marking it as a solution.

View solution in original post

0 Upvotes
2 Replies 2
rhj09
Member

Encrypted mailto Link

SOLVE

Hi Daniel,

To encrypt a mailto link in HubSpot CMS and prevent crawlers from reading the email address, you can use JavaScript to dynamically generate the link. Here’s a basic approach:

 

  1. Create a Script: Insert a script in your HubSpot CMS template or page that generates the mailto link dynamically.

 

<script type="text/javascript">
// Replace 'your-email@example.com' with your actual email address
var encryptedEmail = "your-email@example.com".split('').map(function(char) {
    return '&#' + char.charCodeAt(0) + ';';
}).join('');

document.write('<a href="mailto:' + encryptedEmail + '">Contact Us</a>');
</script>

 


This script converts each character of your email address into its HTML entity (e.g., &#64; for '@').

  • Displaying the Link: When the page loads, JavaScript will render the email address as a clickable mailto link. Crawlers scanning static HTML won't interpret the email address directly.

  • Testing and Deployment: Test the implementation to ensure the email link works correctly. Deploy it on your HubSpot pages where needed.

    This method helps protect your email address from web crawlers while still allowing users to contact you via email. Make sure to replace 'your-email@example.com' with your actual email address in the script.

     

     


    Best regards,
0 Upvotes
evaldas
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Encrypted mailto Link

SOLVE

Hi @danielruch 

 

You can try and encode the email address and add it after the "mailto:" in the href

 

That can be done either through javascript or you can use an online tool like this:

https://mothereff.in/html-entities

 

Which will convert this: example@email.com

 

into this:

 

 

&#x65;&#x78;&#x61;&#x6D;&#x70;&#x6C;&#x65;&#x40;&#x65;&#x6D;&#x61;&#x69;&#x6C;&#x2E;&#x63;&#x6F;&#x6D;

 

 

Then you simply update your href to:

 

 

<a href="mailto:&#x65;&#x78;&#x61;&#x6D;&#x70;&#x6C;&#x65;&#x40;&#x65;&#x6D;&#x61;&#x69;&#x6C;&#x2E;&#x63;&#x6F;&#x6D;">Link to encoded email</a>

 

 

However, this is not guaranteed to prevent crawlers from indexing it.

 

A better option would be to create a HubSpot form, which will not display email addresses of the recipients.

 


✔️ Did this post help answer your query? Help the community by marking it as a solution.

0 Upvotes