From 911f831ea33017e37b95cd6011d9fb1881849c6e Mon Sep 17 00:00:00 2001 From: Mathias Rav Date: Fri, 1 May 2015 17:00:37 +0200 Subject: [PATCH] Remove envelope line from message This appears in Python 2 and not in Python 3 for some reason --- emailtunnel/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emailtunnel/__init__.py b/emailtunnel/__init__.py index d6c19c5..437a6c5 100644 --- a/emailtunnel/__init__.py +++ b/emailtunnel/__init__.py @@ -355,6 +355,11 @@ def process_message(self, peer, mailfrom, rcpttos, str_data): """ data = str_data.encode('latin1') + if six.PY2: + if data.startswith('From nobody'): + # Remove first line which contains useless envelope info + nl = data.index('\n') + data = data[nl+1:] try: ipaddr, port = peer