{"action":"created","issue":{"url":"https://api.github.com/repos/SpamScope/mail-parser/issues/46","repository_url":"https://api.github.com/repos/SpamScope/mail-parser","labels_url":"https://api.github.com/repos/SpamScope/mail-parser/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/SpamScope/mail-parser/issues/46/comments","events_url":"https://api.github.com/repos/SpamScope/mail-parser/issues/46/events","html_url":"https://github.com/SpamScope/mail-parser/issues/46","id":380731618,"node_id":"MDU6SXNzdWUzODA3MzE2MTg=","number":46,"title":"Error: remove_email_envelope() function","user":{"login":"K0dical","id":45007672,"node_id":"MDQ6VXNlcjQ1MDA3Njcy","avatar_url":"https://avatars2.githubusercontent.com/u/45007672?v=4","gravatar_id":"","url":"https://api.github.com/users/K0dical","html_url":"https://github.com/K0dical","followers_url":"https://api.github.com/users/K0dical/followers","following_url":"https://api.github.com/users/K0dical/following{/other_user}","gists_url":"https://api.github.com/users/K0dical/gists{/gist_id}","starred_url":"https://api.github.com/users/K0dical/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/K0dical/subscriptions","organizations_url":"https://api.github.com/users/K0dical/orgs","repos_url":"https://api.github.com/users/K0dical/repos","events_url":"https://api.github.com/users/K0dical/events{/privacy}","received_events_url":"https://api.github.com/users/K0dical/received_events","type":"User","site_admin":false},"labels":[{"id":433729239,"node_id":"MDU6TGFiZWw0MzM3MjkyMzk=","url":"https://api.github.com/repos/SpamScope/mail-parser/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":{"login":"fedelemantuano","id":2412951,"node_id":"MDQ6VXNlcjI0MTI5NTE=","avatar_url":"https://avatars2.githubusercontent.com/u/2412951?v=4","gravatar_id":"","url":"https://api.github.com/users/fedelemantuano","html_url":"https://github.com/fedelemantuano","followers_url":"https://api.github.com/users/fedelemantuano/followers","following_url":"https://api.github.com/users/fedelemantuano/following{/other_user}","gists_url":"https://api.github.com/users/fedelemantuano/gists{/gist_id}","starred_url":"https://api.github.com/users/fedelemantuano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedelemantuano/subscriptions","organizations_url":"https://api.github.com/users/fedelemantuano/orgs","repos_url":"https://api.github.com/users/fedelemantuano/repos","events_url":"https://api.github.com/users/fedelemantuano/events{/privacy}","received_events_url":"https://api.github.com/users/fedelemantuano/received_events","type":"User","site_admin":false},"assignees":[{"login":"fedelemantuano","id":2412951,"node_id":"MDQ6VXNlcjI0MTI5NTE=","avatar_url":"https://avatars2.githubusercontent.com/u/2412951?v=4","gravatar_id":"","url":"https://api.github.com/users/fedelemantuano","html_url":"https://github.com/fedelemantuano","followers_url":"https://api.github.com/users/fedelemantuano/followers","following_url":"https://api.github.com/users/fedelemantuano/following{/other_user}","gists_url":"https://api.github.com/users/fedelemantuano/gists{/gist_id}","starred_url":"https://api.github.com/users/fedelemantuano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedelemantuano/subscriptions","organizations_url":"https://api.github.com/users/fedelemantuano/orgs","repos_url":"https://api.github.com/users/fedelemantuano/repos","events_url":"https://api.github.com/users/fedelemantuano/events{/privacy}","received_events_url":"https://api.github.com/users/fedelemantuano/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-11-14T14:46:40Z","updated_at":"2018-11-28T15:36:07Z","closed_at":"2018-11-18T23:44:31Z","author_association":"NONE","body":"**Describe the bug**\r\nThe method `mailparser.parse_from_bytes(bt)` cannot create a Mailparser object, because the `remove_email_envelope(message)` function called inside fails. The function tries to use a string pattern on a bytes-like object.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. `import mailparser`\r\n2. `mail_obj = open('TEST_Mail.eml', 'rb')`\r\n3. `test_mail = mail_obj.read()`\r\n4. `mail = mailparser.parse_from_bytes(test_mail)`\r\n5. See error\r\n\r\n**Expected behavior**\r\nGetting a Mailparser object.\r\n\r\n**Raw mail**\r\nDelivered-To: raasdnil@gmail.com\r\nReceived: by 10.140.178.13 with SMTP id a13cs354079rvf;\r\n        Fri, 21 Nov 2008 20:05:05 -0800 (PST)\r\nReceived: by 10.151.44.15 with SMTP id w15mr2254748ybj.98.1227326704711;\r\n        Fri, 21 Nov 2008 20:05:04 -0800 (PST)\r\nReturn-Path: test@lindsaar.net\r\nReceived: from mail11.tpgi.com.au (mail11.tpgi.com.au [203.12.160.161])\r\n        by mx.google.com with ESMTP id 10si5117885gxk.81.2008.11.21.20.05.03;\r\n        Fri, 21 Nov 2008 20:05:04 -0800 (PST)\r\nReceived-SPF: neutral (google.com: 203.12.160.161 is neither permitted nor denied by domain of test@lindsaar.net) client-ip=203.12.160.161;\r\nAuthentication-Results: mx.google.com; spf=neutral (google.com: 203.12.160.161 is neither permitted nor denied by domain of test@lindsaar.net) smtp.mail=test@lindsaar.net\r\nX-TPG-Junk-Status: Message not scanned\r\nX-TPG-Antivirus: Passed\r\nReceived: from [192.0.0.253] (60-241-138-146.static.tpgi.com.au [60.0.0.146])\r\n\tby mail11.tpgi.com.au (envelope-from test@lindsaar.net) (8.14.3/8.14.3) with ESMTP id mAM44xew022221\r\n\tfor <raasdnil@gmail.com>; Sat, 22 Nov 2008 15:05:01 +1100\r\nMessage-Id: <6B7EC235-5B17-4CA8-B2B8-39290DEB43A3@test.lindsaar.net>\r\nFrom: Mikel Lindsaar <test@lindsaar.net>\r\nTo: Mikel Lindsaar <raasdnil@gmail.com>\r\nContent-Type: text/plain; charset=US-ASCII; format=flowed\r\nContent-Transfer-Encoding: 7bit\r\nMime-Version: 1.0 (Apple Message framework v929.2)\r\nSubject: Testing 123\r\nDate: Sat, 22 Nov 2008 15:04:59 +1100\r\nX-Mailer: Apple Mail (2.929.2)\r\n\r\nPlain email.\r\n\r\nHope it works well!\r\n\r\nMikel\r\n\r\n**Environment:**\r\n - OS: Linux\r\n - Docker: yes\r\n - mail-parser version 3.7.0\r\n\r\n**Additional context**\r\n- Error:\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/local/lib/python3.6/dist-packages/mailparser/mailparser.py\", line 116, in parse_from_bytes\r\n    return MailParser.from_bytes(bt)\r\n  File \"/usr/local/lib/python3.6/dist-packages/mailparser/mailparser.py\", line 243, in from_bytes\r\n    envelope_present, bt = remove_email_envelope(bt)\r\n  File \"/usr/local/lib/python3.6/dist-packages/mailparser/utils.py\", line 526, in remove_email_envelope\r\n    True if EMAIL_ENVELOPE_PATTERN.search(message) else False\r\nTypeError: cannot use a string pattern on a bytes-like object\r\n"},"comment":{"url":"https://api.github.com/repos/SpamScope/mail-parser/issues/comments/442490657","html_url":"https://github.com/SpamScope/mail-parser/issues/46#issuecomment-442490657","issue_url":"https://api.github.com/repos/SpamScope/mail-parser/issues/46","id":442490657,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MjQ5MDY1Nw==","user":{"login":"dfeinzeig","id":1474946,"node_id":"MDQ6VXNlcjE0NzQ5NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/1474946?v=4","gravatar_id":"","url":"https://api.github.com/users/dfeinzeig","html_url":"https://github.com/dfeinzeig","followers_url":"https://api.github.com/users/dfeinzeig/followers","following_url":"https://api.github.com/users/dfeinzeig/following{/other_user}","gists_url":"https://api.github.com/users/dfeinzeig/gists{/gist_id}","starred_url":"https://api.github.com/users/dfeinzeig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfeinzeig/subscriptions","organizations_url":"https://api.github.com/users/dfeinzeig/orgs","repos_url":"https://api.github.com/users/dfeinzeig/repos","events_url":"https://api.github.com/users/dfeinzeig/events{/privacy}","received_events_url":"https://api.github.com/users/dfeinzeig/received_events","type":"User","site_admin":false},"created_at":"2018-11-28T15:36:07Z","updated_at":"2018-11-28T15:36:07Z","author_association":"CONTRIBUTOR","body":"ah, this was my fault, sorry. @fedelemantuano I can create a fix to handle the python 3 bytes case."}}
{"actor":{"display_login":"dfeinzeig"}}