Class: Torque::Mailer
- Inherits:
-
Object
- Object
- Torque::Mailer
- Defined in:
- lib/torque/mailer.rb
Overview
Handles sending the finished release notes document to a list of emails after Torque generates it
Instance Method Summary collapse
-
#initialize(email, password) ⇒ Mailer
constructor
Creates a Mailer that will send emails from the email address/password combo given.
-
#send_notes(notes_string, subject_line, address_list) ⇒ Object
Sends notes_string as an email with subject_line from an arbitrary email address to everyone on address_list.
Constructor Details
#initialize(email, password) ⇒ Mailer
Creates a Mailer that will send emails from the email address/password combo given
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/torque/mailer.rb', line 14 def initialize(email, password) @email = email @password = password = { :address => "smtp.gmail.com", :port => 587, :domain => 'gmail.com', :user_name => @email, :password => @password, :authentication => 'plain', :enable_starttls_auto => true } Mail.defaults do delivery_method :smtp, end end |
Instance Method Details
#send_notes(notes_string, subject_line, address_list) ⇒ Object
Sends notes_string as an email with subject_line from an arbitrary email address to everyone on address_list
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/torque/mailer.rb', line 36 def send_notes(notes_string, subject_line, address_list) mail = Mail::Message.new mail.charset = "UTF-8" mail.to address_list mail.from @email mail.subject subject_line mail.body notes_string begin mail.deliver rescue Net::SMTPAuthenticationError # TODO Remove this output. Should fail silently and be replaced by an independent call to :verify puts "Username and password not accepted by Gmail. Check your username and password or try using a Gmail " \ "account" end end |