class EventMachine::Protocols::SmtpServer
def process_rcpt_to rcpt
User-written code can return a deferrable from receive_recipient.
for now we'll let that be the user's problem.
We might want to make sure that a given recipient is only seen once, but
recipients per transaction.
TODO: we should enforce user-definable limits on the total number of
All of that is on the user code.
Note that we don't remember or do anything else with the recipients.
we don't need to repeat the tests for TLS and AUTH.
Since we require :mail_from to have been seen before we process RCPT TO,
--
def process_rcpt_to rcpt unless @state.include?(:mail_from) send_data "503 MAIL is required before RCPT\r\n" else succeeded = proc { send_data "250 Ok\r\n" @state << :rcpt unless @state.include?(:rcpt) } failed = proc { send_data "550 recipient is unacceptable\r\n" } d = receive_recipient rcpt if d.respond_to?(:set_deferred_status) d.callback(&succeeded) d.errback(&failed) else (d ? succeeded : failed).call end unless receive_recipient rcpt send_data "550 recipient is unacceptable\r\n" else send_data "250 Ok\r\n" @state << :rcpt unless @state.include?(:rcpt) end end end