class EventMachine::Protocols::SmtpServer

def process_auth str


response and a continuation of the auth conversation.
TODO, support clients that send AUTH PLAIN with no parameter, expecting a 3xx
So far, only AUTH PLAIN is supported but we should do at least LOGIN as well.
--
def process_auth str
  if @state.include?(:auth)
    send_data "503 auth already issued\r\n"
  elsif str =~ /\APLAIN\s?/i
    if $'.length == 0
      # we got a partial response, so let the client know to send the rest
      @state << :auth_incomplete
      send_data("334 \r\n")
    else
      # we got the initial response, so go ahead & process it
      process_auth_line($')
    end
    #elsif str =~ /\ALOGIN\s+/i
  else
    send_data "504 auth mechanism not available\r\n"
  end
end