#NEWLINE# def _command_MAIL( self , arg ) : #NEWLINE# #INDENT# match = from_pattern . match ( arg ) #NEWLINE# if ( not match ) : #NEWLINE# #INDENT# bad_arguments . send ( self . io ) #NEWLINE# return #NEWLINE# #UNINDENT# start = match . end ( 0 ) #NEWLINE# end = find_outside_quotes ( arg , b'>' , start ) #NEWLINE# if ( end == ( - 1 ) ) : #NEWLINE# #INDENT# bad_arguments . send ( self . io ) #NEWLINE# return #NEWLINE# #UNINDENT# address = arg [ start : end ] . decode ( 'utf-8' ) #NEWLINE# if ( not self . ehlo_as ) : #NEWLINE# #INDENT# bad_sequence . send ( self . io ) #NEWLINE# return #NEWLINE# #UNINDENT# if self . have_mailfrom : #NEWLINE# #INDENT# bad_sequence . send ( self . io ) #NEWLINE# return #NEWLINE# #UNINDENT# params = self . _gather_params ( arg [ ( end + 1 ) : ] ) #NEWLINE# if ( b'SIZE' in params ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# size = int ( params [ b'SIZE' ] ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# bad_arguments . send ( self . io ) #NEWLINE# return #NEWLINE# #UNINDENT# max_size = self . extensions . getparam ( 'SIZE' , filter = int ) #NEWLINE# if ( max_size is not None ) : #NEWLINE# #INDENT# if ( size > max_size ) : #NEWLINE# #INDENT# m = '5.3.4 Message size exceeds {0} limit' . format ( max_size ) #NEWLINE# Reply ( '552' , m ) . send ( self . io ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# unknown_parameter . send ( self . io ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# reply = Reply ( '250' , '2.1.0 Sender <{0}> Ok' . format ( address ) ) #NEWLINE# self . _call_custom_handler ( 'MAIL' , reply , address , params ) #NEWLINE# reply . send ( self . io ) #NEWLINE# self . _check_close_code ( reply ) #NEWLINE# self . have_mailfrom = ( self . have_mailfrom or ( reply . code == '250' ) )