Class: Caboose::SmtpConfig

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/caboose/smtp_config.rb

Constant Summary collapse

AUTH_PLAIN =
'plain'
AUTH_LOGIN =
'login'
AUTH_MD5 =
'cram_md5'

Class Method Summary collapse

Class Method Details

.configure_for_site(mailer, site_id) ⇒ Object


21
22
23
# File 'app/models/caboose/smtp_config.rb', line 21

def self.configure_for_site(mailer, site_id)
  return self.configure_mailer_for_site(mailer, site_id)
end

.configure_mailer_for_site(mailer, site_id) ⇒ Object


25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/caboose/smtp_config.rb', line 25

def self.configure_mailer_for_site(mailer, site_id)
  c = self.where(:site_id => site_id).first
  
  mailer.smtp_settings['user_name']            = c.user_name
  mailer.smtp_settings['password']             = c.password
  mailer.smtp_settings['address']              = c.address
  mailer.smtp_settings['port']                 = c.port
  mailer.smtp_settings['domain']               = c.domain
  mailer.smtp_settings['authentication']       = c.authentication
  mailer.smtp_settings['enable_starttls_auto'] = c.enable_starttls_auto
  
  return mailer
end