Class: Lazylead::Smtp

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/smtp.rb

Overview

The emails configuration over SMTP protocol.

Author

Yurii Dubinka ([email protected])

Copyright

Copyright © 2019-2020 Yurii Dubinka

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new, salt = NoSalt.new, opts = {}) ⇒ Smtp

Returns a new instance of Smtp.



38
39
40
41
42
# File 'lib/lazylead/smtp.rb', line 38

def initialize(log = Log.new, salt = NoSalt.new, opts = {})
  @log = log
  @salt = salt
  @opts = opts
end

Instance Method Details

#enableObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/lazylead/smtp.rb', line 44

def enable
  if @opts.empty? || @opts[:test_mode] || @opts[:smtp_host].blank?
    Mail.defaults do
      delivery_method :test
    end
    @log.warn "SMTP connection enabled in " \
              "#{'test'.colorize(:light_yellow)} mode."
  else
    setup_smtp
  end
end