class Em::Smtp::Client

Attributes

settings[RW]

Public Class Methods

new(values) click to toggle source
# File lib/em/smtp/client.rb, line 6
def initialize(values)
  self.settings = {
    host:     'localhost',
    port:     25,   # optional, defaults 25
    starttls: true, # use ssl
    domain:   'localhost.localdomain',
    #auth:     {
    #            type:     nil, # :plain
    #            username: nil, # 'username'
    #            password: nil  # 'password'
    #          }
  }.merge!(values)
end

Public Instance Methods

deliver!(mail) click to toggle source
# File lib/em/smtp/client.rb, line 22
def deliver!(mail)
  email = EM::Protocols::SmtpClient.send(settings.merge!({
    to:       mail[:to].formatted,
    from:     mail[:from].addresses[0],
    content:  "#{mail.encoded}\r\n.\r\n"
  }))
  # Ignore callbacks now XD
  #email.callback{
  #}
  #email.errback{ |e|
  #}
end