Class: AlleJest::Emailer

Inherits:
Object
  • Object
show all
Includes:
HasAttributes
Defined in:
lib/allejest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#emailObject

Returns the value of attribute email.



196
197
198
# File 'lib/allejest.rb', line 196

def email
  @email
end

#firstnameObject

Returns the value of attribute firstname.



196
197
198
# File 'lib/allejest.rb', line 196

def firstname
  @firstname
end

#from_addressObject

Returns the value of attribute from_address.



196
197
198
# File 'lib/allejest.rb', line 196

def from_address
  @from_address
end

#from_emailObject

Returns the value of attribute from_email.



196
197
198
# File 'lib/allejest.rb', line 196

def from_email
  @from_email
end

#lastnameObject

Returns the value of attribute lastname.



196
197
198
# File 'lib/allejest.rb', line 196

def lastname
  @lastname
end

#resultsObject

Returns the value of attribute results.



196
197
198
# File 'lib/allejest.rb', line 196

def results
  @results
end

#smtpObject

Returns the value of attribute smtp.



196
197
198
# File 'lib/allejest.rb', line 196

def smtp
  @smtp
end

Instance Method Details

#send_mailObject



198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/allejest.rb', line 198

def send_mail
  raw_erb = File.read(find_erb_path)
  erb = ERB.new(raw_erb)

  email_body = erb.result(binding) #.gsub(/^\s*/, '')

  pony_opts = {:to => "#{firstname} #{lastname} <#{email}>", :from => from_address,
    :body => email_body, :subject => "AlleJest report for #{Time.new.rfc2822}" }
  #puts pony_opts.inspect

  Pony.mail(pony_opts)
end