class Mailer
Public Class Methods
new(username, password)
click to toggle source
# File lib/mailer.rb, line 4 def initialize(username, password) @username = username @password = password end
Public Instance Methods
send(to_, cc_, from_, subject_, body_)
click to toggle source
# File lib/mailer.rb, line 9 def send(to_, cc_, from_, subject_, body_) options = {:address => "smtp.gmail.com", :port => 587, :user_name => @username, :password => @password, :authentication => 'plain', :enable_starttls_auto => true} mail = Mail.new do delivery_method :smtp, options to to_ cc cc_ from from_ subject subject_ end html_part = Mail::Part.new do content_type 'text/html; charset=UTF-8' body "#{body_}\n #{File.read('email_footer.html')}" end mail.html_part = html_part mail.deliver end