<s> import logging <EOL> from google . appengine . ext . webapp . mail_handlers import InboundMailHandler <EOL> import webapp2 <EOL> class LogSenderHandler ( InboundMailHandler ) : <EOL> def receive ( self , mail_message ) : <EOL> logging . info ( "<STR_LIT>" + mail_message . sender ) <EOL> plaintext_bodies = mail_message . bodies ( '<STR_LIT>' ) <EOL> html_bodies = mail_message . bodies ( '<STR_LIT>' ) <EOL> for content_type , body in html_bodies : <EOL> decoded_html = body . decode ( ) <EOL> logging . info ( "<STR_LIT>" , len ( decoded_html ) ) <EOL> for content_type , body in plaintext_bodies : <EOL> plaintext = body . decode ( ) <EOL> logging . info ( "<STR_LIT>" , len ( plaintext ) ) <EOL> app = webapp2 . WSGIApplication ( [ LogSenderHandler . mapping ( ) ] , debug = True ) </s>
