Sha256: 01ee6ef9cfa7a4124e1bbd6224de45510b90599eacf3c86fc6fc3ffc186b6e66

Contents?: true

Size: 771 Bytes

Versions: 14

Compression:

Stored size: 771 Bytes

Contents

require 'net/smtp'

module MList
  module EmailServer
    
    class Smtp < Base
      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
      
      def execute
        raise "Mail cannot be received through an SMTP server. Please use the '#{MList::EmailServer::Default.name}' type."
      end
    end
    
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mlist-0.1.23 lib/mlist/email_server/smtp.rb
mlist-0.1.22 lib/mlist/email_server/smtp.rb
mlist-0.1.21 lib/mlist/email_server/smtp.rb
mlist-0.1.20 lib/mlist/email_server/smtp.rb
mlist-0.1.19 lib/mlist/email_server/smtp.rb
mlist-0.1.18 lib/mlist/email_server/smtp.rb
mlist-0.1.17 lib/mlist/email_server/smtp.rb
mlist-0.1.16 lib/mlist/email_server/smtp.rb
mlist-0.1.14 lib/mlist/email_server/smtp.rb
mlist-0.1.13 lib/mlist/email_server/smtp.rb
mlist-0.1.12 lib/mlist/email_server/smtp.rb
mlist-0.1.11 lib/mlist/email_server/smtp.rb
mlist-0.1.10 lib/mlist/email_server/smtp.rb
mlist-0.1.9 lib/mlist/email_server/smtp.rb