Spambot-Resistant Email Link
Protect Email Addresses From Automated Spam Harvesters
What You'll Learn
Mailto Protocol
Learn how to create clickable email links using the standard mailto protocol. Understand the basic implementation and its immediate benefits for user experience.
Security Vulnerabilities
Discover why standard mailto links expose your email to spam harvesters. Learn about automated bots that scan websites for email addresses.
JavaScript Protection
Implement JavaScript obfuscation techniques to hide email addresses from spambots while maintaining functionality for legitimate users.
Exercise Workflow
Setup Files
Open the Revolution Travel Contact folder and locate contact.html file in your code editor
Create Basic Email Link
Add a standard mailto link using the hello@revolutiontravel.com email address
Implement Protection
Replace the basic mailto with JavaScript obfuscation code to prevent spam harvesting
Customize Settings
Configure the email variables and add a custom subject line for better user experience
The mailto protocol relies on the user's computer having a configured email program. Users with web-based email like Gmail may not see the link function as expected, but they can still view the email address on the webpage.
Email Display Methods
| Feature | Plain Text | Mailto Link |
|---|---|---|
| User Experience | Manual copy-paste required | One-click email opening |
| Functionality | Static display only | Interactive launching |
| Accessibility | Always visible | Requires email program setup |
| Spam Protection | Minimal protection | Easily harvested by bots |
Email harvesters are automated programs that scan websites specifically looking for mailto links and email addresses. These bots can quickly extract your email and add it to spam databases, resulting in increased unwanted messages.
JavaScript Email Obfuscation
JavaScript Implementation Process
Copy Base Script
Open spam-proof-email.html and copy the complete JavaScript code template
Replace Mailto Link
Paste the JavaScript code over your existing mailto link in contact.html
Configure Variables
Edit 'your-name' to 'hello' and 'your-domain' to 'revolutiontravel' in the script
Set Subject Line
Add 'Travel Inquiry' to the eSubject variable for pre-filled email subjects
Test Functionality
Save and preview in browser to verify the email link works with custom subject line
JavaScript Email Protection Features
Variable Obfuscation
Breaks email addresses into separate variables that spambots cannot easily piece together. Uses nonsense variable names to confuse automated scanners.
String Concatenation
Combines email parts using JavaScript operators rather than displaying the complete address in HTML. This technique hides the full email from source code inspection.
Dynamic Generation
Creates the mailto link programmatically when the page loads rather than hardcoding it in HTML. This prevents static analysis by harvesting tools.
Key Takeaways
