class Martilla::Smtp

Public Instance Methods

error(msg, data) click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 15
def error(msg, data)
  Pony.mail(to: to_email,
            from: from_email,
            subject: failure_subject,
            via: :smtp,
            html_body: error_html(msg, data),
            body: error_txt(msg, data),
            via_options: via_options)
end
success(data) click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 5
def success(data)
  Pony.mail(to: to_email,
            from: from_email,
            subject: success_subject,
            via: :smtp,
            html_body: success_html(data),
            body: success_txt(data),
            via_options: via_options)
end

Private Instance Methods

address() click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 38
def address
  email = @options['address']
  raise config_error('address') if email.nil?
  email
end
authentication() click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 66
def authentication
  @options['authentication'] || :plain
end
domain() click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 44
def domain
  smtp_domain = @options['domain']
  raise config_error('domain') if smtp_domain.nil?
  smtp_domain
end
password() click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 56
def password
  smtp_password = @options['password']
  raise config_error('password') if smtp_password.nil?
  smtp_password
end
port() click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 62
def port
  @options['port'] || '25'
end
user_name() click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 50
def user_name
  smtp_user_name = @options['user_name']
  raise config_error('user_name') if smtp_user_name.nil?
  smtp_user_name
end
via_options() click to toggle source
# File lib/martilla/notifiers/smtp.rb, line 27
def via_options
  {
    address: address,
    port: port,
    user_name: user_name,
    password: password,
    authentication: authentication, # :plain, :login, :cram_md5, no auth by default
    domain: domain # the HELO domain provided by the client to the server
  }
end