Class: ActionGmailer::DeliveryMethod

Inherits:
Object
  • Object
show all
Includes:
Mail::CheckDeliveryParams
Defined in:
lib/action_gmailer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mail::CheckDeliveryParams

included

Constructor Details

#initialize(settings) ⇒ DeliveryMethod

Returns a new instance of DeliveryMethod.



21
22
23
# File 'lib/action_gmailer.rb', line 21

def initialize(settings)
  self.settings = settings
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



19
20
21
# File 'lib/action_gmailer.rb', line 19

def 
  @account
end

#auth_typeObject

Returns the value of attribute auth_type.



18
19
20
# File 'lib/action_gmailer.rb', line 18

def auth_type
  @auth_type
end

#helo_domainObject

Returns the value of attribute helo_domain.



18
19
20
# File 'lib/action_gmailer.rb', line 18

def helo_domain
  @helo_domain
end

#oauth2_tokenObject

Returns the value of attribute oauth2_token.



19
20
21
# File 'lib/action_gmailer.rb', line 19

def oauth2_token
  @oauth2_token
end

#settingsObject

Returns the value of attribute settings.



15
16
17
# File 'lib/action_gmailer.rb', line 15

def settings
  @settings
end

#smtp_hostObject

Returns the value of attribute smtp_host.



17
18
19
# File 'lib/action_gmailer.rb', line 17

def smtp_host
  @smtp_host
end

#smtp_portObject

Returns the value of attribute smtp_port.



17
18
19
# File 'lib/action_gmailer.rb', line 17

def smtp_port
  @smtp_port
end

Instance Method Details

#deliver!(mail) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/action_gmailer.rb', line 30

def deliver!(mail)
  envelope_from, destinations, message = check_params(mail)

  smtp = Net::SMTP.new(smtp_host, smtp_port)
  smtp.enable_starttls_auto
  smtp.start(helo_domain, , oauth2_token, auth_type) do
    smtp.sendmail(message, envelope_from, destinations)
  end
rescue StandardError => exp
  raise DeliveryError, exp.message
end