Class: Mailer

Inherits:
Object
  • Object
show all
Defined in:
lib/backupper/mailer.rb

Class Method Summary collapse

Class Method Details

.send(from:, to:, password:, report:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/backupper/mailer.rb', line 4

def self.send(from:, to:, password:, report:)
  options = {
    address:              'smtp.gmail.com',
    port:                 587,
    user_name:            from,
    password:             password,
    authentication:       'plain',
    enable_starttls_auto: true
  }
  Mail.defaults do
    delivery_method :smtp, options
  end
  Mail.deliver(to: to, from: from, subject: generate_subject(report), body: generate_body(report))
end