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



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/backupper/mailer.rb', line 5

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 do
    to to
    from from
    subject Mailer.subject(report)
    body Mailer.body(report)
  end
end