1+ # Copyright The IETF Trust 2014-2019, All Rights Reserved
2+
13import smtpd
24import threading
35import asyncore
46
7+ import debug # pyflakes:ignore
8+
59class AsyncCoreLoopThread (object ):
610
711 def wrap_loop (self , exit_condition , timeout = 1.0 , use_poll = False , map = None ):
@@ -27,18 +31,22 @@ def stop(self):
2731
2832class SMTPTestChannel (smtpd .SMTPChannel ):
2933
34+ # mail_options = ['BODY=8BITMIME', 'SMTPUTF8']
35+
3036 def smtp_RCPT (self , arg ):
31- if not self ._SMTPChannel__mailfrom :
37+ self .rcpt_options = []
38+ if not self .mailfrom :
3239 self .push ('503 Error: need MAIL command' )
3340 return
34- address = self ._SMTPChannel__getaddr ('TO:' , arg ) if arg else None
41+ arg = self ._strip_command_keyword ('TO:' , arg )
42+ address , params = self ._getaddr (arg )
3543 if not address :
3644 self .push ('501 Syntax: RCPT TO: <address>' )
3745 return
3846 if "poison" in address :
3947 self .push ('550 Error: Not touching that' )
4048 return
41- self ._SMTPChannel__rcpttos .append (address )
49+ self .rcpttos .append (address )
4250 self .push ('250 Ok' )
4351
4452class SMTPTestServer (smtpd .SMTPServer ):
@@ -57,7 +65,7 @@ def handle_accept(self):
5765 #channel = SMTPTestChannel(self, conn, addr)
5866 SMTPTestChannel (self , conn , addr )
5967
60- def process_message (self , peer , mailfrom , rcpttos , data ):
68+ def process_message (self , peer , mailfrom , rcpttos , data , mail_options = [], rcpt_options = [] ):
6169 self .inbox .append (data )
6270
6371
0 commit comments