Permalink
Browse files

Replacing SMTP codes to fit RFC 2821

  • Loading branch information...
1 parent 39f4d24 commit a2e17780d107e1219306d82bfe164a368a06c41d @hron84 hron84 committed Jan 12, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/mini-smtp-server/mini-smtp-server.rb
@@ -31,16 +31,16 @@ def process_line(line)
# Handle specific messages from the client
case line
when (/^(HELO|EHLO)/)
- return "220 go on...\r\n"
+ return "250 #{Socket.gethostname} go on...\r\n"
when (/^QUIT/)
Thread.current[:connection_active] = false
return ""
when (/^MAIL FROM\:/)
Thread.current[:message][:from] = line.gsub(/^MAIL FROM\:/, '').strip
- return "220 OK\r\n"
+ return "250 OK\r\n"
when (/^RCPT TO\:/)
Thread.current[:message][:to] = line.gsub(/^RCPT TO\:/, '').strip
- return "220 OK\r\n"
+ return "250 OK\r\n"
when (/^DATA/)
Thread.current[:data_mode] = true
return "354 Enter message, ending with \".\" on a line by itself\r\n"
@@ -52,7 +52,7 @@ def process_line(line)
if((Thread.current[:data_mode]) && (line.chomp =~ /^\.$/))
Thread.current[:message][:data] += line
Thread.current[:data_mode] = false
- return "220 OK\r\n"
+ return "250 OK\r\n"
end
# If we are in date mode then we need to add
@@ -69,4 +69,4 @@ def process_line(line)
def new_message_event(message_hash)
end
-end
+end

0 comments on commit a2e1778

Please sign in to comment.