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

redsnapper-mail

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redsnapper-mail

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Mail Lib

An mail parsing lib.

== Features

  • clean API

== Usage

Create new Mail

mail = Mail::Mail.new
mail.header.to = "test_to@test.de"
mail.header.from = "test_from@test.de"
mail.header.subject = "Test Mail"
mail.header.content_transfer_encoding = "quoted-printable"
mail.header.content_type.charset = "UTF-8"
mail.content = {:text_plain => "Hallo World !!!"}

Create new Mail with Text and HTML part

mail = Mail::Mail.new
mail.header.to = "test_to@test.de"
mail.header.from = "test_from@test.de"
mail.header.subject = "Test Mail"
mail.header.content_transfer_encoding = "quoted-printable"
mail.header.content_type.charset = "UTF-8"
mail.content = {
  :text_plain => "Hallo World !!!",
  :text_html => "<strong>Hallo World !!!</strong>"
}

Create new Mail Attachment

mail = Mail::Mail.new
mail.header.to = "test_to@test.de"
mail.header.from = "test_from@test.de"
mail.header.subject = "Test Mail"
mail.header.content_transfer_encoding = "quoted-printable"
mail.header.content_type.charset = "UTF-8"
mail.content = {
  :text_plain => "Hallo World !!!",
  :image_jpeg => File.read("path/to/image")
}

Load an existing Mail

  mail = Mail::Mail.new(File.read("path/to/mail"))

  puts mail.header.to  => ["test_to@test.de"]

Get attachments from a Mail

mail = Mail::Mail.new(File.read("path/to/mail"))

if mail.header.attachments?
    mail.attachments do |attachment|
        puts attachment.header.content_type.type   =>   "image/tiff"
        puts attachment.header.content_disposition.filename  =>  "fax.tif"
        puts attachment.size  =>  408850
    end
end

FAQs

Package last updated on 10 Aug 2014

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