Class: MList::EmailServer::Smtp

Inherits:
Base
  • Object
show all
Defined in:
lib/mlist/email_server/smtp.rb

Instance Attribute Summary

Attributes inherited from Base

#settings

Instance Method Summary collapse

Methods inherited from Base

#generate_message_id, #initialize, #receive, #receiver

Constructor Details

This class inherits a constructor from MList::EmailServer::Base

Instance Method Details

#deliver(tmail) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/mlist/email_server/smtp.rb', line 7

def deliver(tmail)
  destinations = tmail.destinations
  tmail.delete_no_send_fields
  smtp = Net::SMTP.new(settings[:address], settings[:port])
  smtp.enable_starttls_auto if settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
  smtp.start(settings[:domain], settings[:user_name], settings[:password],
             settings[:authentication]) do |smtp|
    smtp.sendmail(tmail.encoded, tmail['sender'], destinations)
  end
end

#executeObject



18
19
20
# File 'lib/mlist/email_server/smtp.rb', line 18

def execute
  raise "Mail cannot be received through an SMTP server. Please use the '#{MList::EmailServer::Default.name}' type."
end