Imaplib: Get AmazonSES DSN

Uncategorized

    import email msg = email.message_from_string(emailstr) if (msg.is_multipart() and len(msg.get_payload()) > 1 and msg.get_payload(1).get_content_type() == ‘message/delivery-status’): # email is DSN print(msg.get_payload(0).get_payload()) # human-readable section for dsn in msg.get_payload(1).get_payload(): print(‘action: %s’ % dsn[‘action’]) # e.g., “failed”, “delivered” if len(msg.get_payload()) > […]

Read more >