Class: Lazylead::StdoutPostman

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

Overview

A postman that sends emails to the std out.

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new) ⇒ StdoutPostman

Returns a new instance of StdoutPostman.



86
87
88
# File 'lib/lazylead/postman.rb', line 86

def initialize(log = Log.new)
  @log = log
end

Instance Method Details

#send(opts) ⇒ Object

Send an email.

:opts

the mail configuration like to, from, cc, subject, template.



92
93
94
95
96
97
98
99
# File 'lib/lazylead/postman.rb', line 92

def send(opts)
  if opts.msg_to.empty?
    p "Email can't be sent as 'to' is empty, more: '#{opts}'"
  else
    p "to=#{opts.msg_to}, from=#{opts.msg_from}, cc=#{opts.msg_cc}, " \
      "subject=#{opts['subject']}, attachments=#{opts.msg_attachments}, body=#{opts.msg_body}"
  end
end