Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mail-embed-html-images

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mail-embed-html-images

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

mail-embed-html-images

Extends Mail to provide a mechanism for converting external image sources to embedded attachments.

Usage

require 'mail'
require 'mail/embed-html-images'

mail = Mail.new do
  from       'sender@example.com'
  to         'recipient@example.com''
  subject    'This is a test email'
  html_part  File.read('body.html')
end

mail.embed_html_images
mail.deliver

The embed_html_images method looks for image tags with http[s] sources, downloads the image from the src attribute, adds it as an attachment, and replaces the original src attribute with a cid reference to the attachment.

It keeps track of downloaded files so if you have two images with the same source it will only download and attach tha image once and ref the same attachment from both images.

If you change the html_part, then you will need to re-run embed_html_images. This will download any new images found, and remove any attached images which are no longer required.

That is all.

FAQs

Package last updated on 04 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc