Class: Minbox::Cli::Application

Inherits:
Thor
  • Object
show all
Defined in:
lib/minbox/cli.rb

Instance Method Summary collapse

Instance Method Details

#send(host = 'localhost', port = 25) ⇒ Object



20
21
22
23
24
25
# File 'lib/minbox/cli.rb', line 20

def send(host = 'localhost', port = 25)
  Net::SMTP.start(host, port) do |smtp|
    smtp.debug_output = Minbox.logger
    smtp.send_message(create_mail(options).to_s, options[:from], options[:to])
  end
end

#server(host = 'localhost', port = '25') ⇒ Object



30
31
32
33
34
35
36
# File 'lib/minbox/cli.rb', line 30

def server(host = 'localhost', port = '25')
  publisher = Publisher.from(options[:output])
  server = Server.new(host: host, port: port, tls: options[:tls])
  server.listen! do |mail|
    publisher.publish(mail)
  end
end

#versionObject



39
40
41
# File 'lib/minbox/cli.rb', line 39

def version
  say Minbox::VERSION
end