Module: Detroit::EmailUtils

Defined in:
lib/detroit/email_utils.rb

Overview

The Mail utility module provides an easy to use ‘email` method.

Instance Method Summary collapse

Instance Method Details

#email(options) ⇒ Object

Email function to easily send out an email.

Settings:

subject      Subject of email message.
from         Message FROM address [email].
to           Email address to send announcemnt.
server       Email server to route message.
port         Email server's port.
domain       Email server's domain name.
      Email  name if needed.
password     Password for ..
         type: plain, cram_md5 or  [plain].
secure       Uses TLS security, true or false? [false]
message      Mesage to send -or-
file         File that contains message.


25
26
27
28
29
30
31
32
33
34
# File 'lib/detroit/email_utils.rb', line 25

def email(options)
  #options[:file] = localize(options[:file]) if options[:file]
  emailer = Emailer.new(options.rekey)
  success = emailer.email
  if Exception === success
    puts "Email failed: #{success.message}."
  else
    puts "Email sent successfully to #{success.join(';')}."
  end
end