From 082595feeba5544c28b5d968e53b1d8d954039d2 Mon Sep 17 00:00:00 2001 From: Tom Freudenberg Date: Sat, 1 Aug 2015 13:17:30 +0200 Subject: [PATCH] add: support EHLO command and reply with enabled extensions --- lib/midi-smtp-server.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/midi-smtp-server.rb b/lib/midi-smtp-server.rb index 422b70a..3d815a6 100644 --- a/lib/midi-smtp-server.rb +++ b/lib/midi-smtp-server.rb @@ -293,8 +293,16 @@ def process_line(line) Thread.current[:ctx][:server][:helo] = @cmd_data # set sequence state as RSET Thread.current[:cmd_sequence] = :CMD_RSET - # reply ok - return "250 OK" + # check whether to answer as HELO or EHLO + if line =~ /^EHLO/i + # reply supported extensions + return "250-8BITMIME\r\n" + + (@auth_mode != :AUTH_FORBIDDEN ? "250-AUTH LOGIN PLAIN\r\n" : "") + + "250 OK" + else + # reply ok only + return "250 OK" + end when (/^AUTH(\s+)((LOGIN|PLAIN)(\s+[A-Z0-9=]+)?|CRAM-MD5)\s*$/i) # AUTH