Sha256: 8c814b942dac490d84bf2f35988c0f0eeff27cdf95827b283dab5034555a2ad9

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

module MailSandbox
  class Server < EventMachine::Protocols::SmtpServer

    def receive_plain_auth(user, password)
      message.user = user
      message.password = password

      true
    end

    def receive_sender(sender)
      message.sender = sender
      true
    end

    def receive_recipient(recipient)
      message.recipient = recipient
      true
    end

    def receive_message
      message.completed_at = Time.now
      MailSandbox.subscriber.notify(message)
      true
    end

    def process_data_line ln
      super ln
      message.data << ln
      true
    end

    def message
      @message ||= MailSandbox::Message.new
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mail_sandbox-0.1.2 lib/mail_sandbox/server.rb
mail_sandbox-0.1.1 lib/mail_sandbox/server.rb
mail_sandbox-0.1.0 lib/mail_sandbox/server.rb