W3cubDocs

/Padrino

Module: Padrino::Mailer::Mime

Overview

Handles MIME type declarations for mail delivery.

Constant Summary

MIME_TYPES =

List of common mime-types, selected from various sources according to their usefulness for an email scope.

You can add your own mime types like:

Padrino::Mailer::Mime::MIME_TYPES.merge!("text/xml" => :xml)
{
  "text/html"  => :html,
  "text/plain" => :plain,
  "text/xml"   => :xml
}

Class Method Summary

Class Method Details

.mime_type(mime, fallback = :plain) ⇒ Object

Returns Symbol with mime type if found, otherwise use fallback. mime should be the content type like “text/plain” fallback may be any symbol.

Also see the documentation for MIME_TYPES.

This is a shortcut for:

Padrino::Mailer::Mime::MIME_TYPES.fetch('text/plain', :plain)

Examples:

Padrino::Mailer::Mime.mime_type('text/plain')
# => :plain
Padrino::Mailer::Mime.mime_type('text/html')
# => :html

Parameters:

  • mime (String) — The mime alias to fetch (i.e 'text/plain').
  • fallback (Symbol) (defaults to: :plain) — The fallback mime to use if mime doesn't exist.

© 2010–2016 Padrino
Licensed under the MIT License.
http://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Mailer/Mime