Module: Omail

Defined in:
lib/omail.rb,
lib/omail/core.rb,
lib/omail/railtie.rb,
lib/omail/version.rb,
lib/generators/templates/omail.rb,
lib/generators/omail/install_generator.rb

Overview

Omail module

Defined Under Namespace

Classes: EmailInterceptor, InstallGenerator, Railtie

Constant Summary collapse

VERSION =
"0.4.3"

Class Method Summary collapse

Class Method Details

.to_mailbox(mail, appname) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/omail/core.rb', line 8

def to_mailbox(mail, appname)
  filename = "#{mail.to.first}-#{Time.now.to_i}_#{SecureRandom.hex(6)}.html"

  File.open(base_directory(appname.downcase, filename), "w") do |file|
    if mail.html_part
      file.write(mail.html_part.body.to_s)
    else
      file.write(mail.body.to_s)
    end
  end
end