Skip to content

email5/imageblocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

ImageBlocker.js

ImageBlocker.js is a lightweight, open-source JavaScript library designed to block external images in HTML5 emails, enhancing security by preventing unauthorized content from rendering. It ensures only trusted domains are allowed for image and background image sources.

Features

  • Blocks images (<img> tags) from untrusted domains.
  • Neutralizes background images defined in inline styles.
  • Simple configuration with a customizable allowedDomains array.
  • Lightweight and optimized for HTML5 email environments.

Installation

  1. Clone the repository:
    git clone https://github.com/email5/imageblocker.git
    
  2. Navigate to the project directory:
    cd imageblocker
    

Setup

To include ImageBlocker.js in your HTML email or project:

  1. Add the following <script> tag to your email setup:

    <script src="src/ImageBlocker.js"></script>
  2. Customize the list of trusted domains by editing the allowedDomains array in the script:

    const allowedDomains = ["trustedcdn.com", "secure-site.org"];

How It Works

  • Image Blocking: All <img> tags with src attributes pointing to untrusted domains are blocked and hidden from the email content.
  • Background Image Removal: Inline styles containing untrusted background-image URLs are neutralized.
  • Customizable: Easily define your list of trusted domains to fit your security requirements.

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch.
  3. Submit a pull request with your changes.

License

This project is licensed under the MIT License.

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors