def get_raw_email(self):
if '<STR_LIT:email>' in self.payload:<EOL><INDENT>raw_email = email.message_from_string(self.payload['<STR_LIT:email>'])<EOL>return raw_email<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>
This only applies to raw payloads:
https://sendgrid.com/docs/Classroom/Basics/Inbound_Parse_Webhook/setting_up_the_inbound_parse_webhook.html#-Raw-Parameters