Sha256: ed5cab75ad4780e5c59ea0a4d156ebec3cff7bf2d18850b5f7d602d70ac51341

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 Bytes

Contents

require 'net/smtp'

module MList
  module EmailServer
    
    class Smtp < Base
      def deliver(tmail, destinations)
        sender = tmail['return-path'] || tmail.from
        Net::SMTP.start(settings[:address], settings[:port], settings[:domain],
            settings[:user_name], settings[:password], settings[:authentication]) do |smtp|
          smtp.sendmail(tmail.encoded, 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

1 entries across 1 versions & 1 rubygems

Version Path
aiwilliams-mlist-0.1.0 lib/mlist/email_server/smtp.rb