Comments (11)
Hi,
which version of mailparser are you using?
from mail-parser.
mail-parser==1.2.1
i can pm you the data. but i don't really want to post it publicly?
from mail-parser.
You could send me a mail on
mantuano.fedele at gmail.com
Is response_part[1] a byte type? Did you try with mailparser.parse_from_string?
from mail-parser.
i use pycharm and looked through it with the debugger.
code is below. the data inspected was of bytes type
this is in python3.6 and i forwarded you the unsanitised data to your email
def check_mail_by_id(self, message_id: AnyStr) -> mailparser.MailParser:
_, header_data_raw = self.imap.fetch(message_id, '(BODY.PEEK[HEADER])')
for response_part in header_data_raw:
if isinstance(response_part, tuple):
headers = mailparser.parse_from_bytes(response_part[1])
return headers
from mail-parser.
In your header there isn't the to:
File "C:\project\venv\lib\site-packages\mailparser\mailparser.py", line 217, in make_mail
"to": self.to,
File "C:\project\venv\lib\site-packages\mailparser\mailparser.py", line 383, in to_
self.message.get('to', self.message.get('delivered-to')))
So the parsing fails because the email should have to.
Are you sure that you take all email with self.imap.fetch.
mailparser works with all raw mail.
from mail-parser.
well i'm parsing the headers first. You can see that i'm using the BODY,PEEK[HEADER] in the fetch
this mail when i checked in outlook didn't have anyone in the to section either.
the only thing missing should be the body of the mail.
from mail-parser.
The best way is:
- Get all mail, and put it in a variable
- Check with print the header (only for debug)
- I could fix this problem, but the mail should have a
to
in the headers
The code part is this.
from mail-parser.
i saw that. my issue is that this mail doesn't have a deliviered-to header. which makes the parser fail.
the mail is being read by imap from office365.
i don't want to pull the full mails as in my use case i'm accessing my own inbox and it's simpler to not have to mark everything unread again.
from mail-parser.
Ok, you can take only headers, and mailparser should work fine because there are mails without body or attachments.
In your mail there aren't to
and deliviered-to header
, because deliviered-to header
is the fallback of to
.
You can try to catch TypeError
and print headers. Then post here obfuscated hearders, so I can check.
from mail-parser.
that's why i emailed you the headers.
from mail-parser.
Fixed with commit 0219562c84de32d63deb10417278380063337024
from mail-parser.
Related Issues (20)
- Drop simplejson requirement
- Multiple mail thread handling HOT 2
- When parsing eml attachment from Gmail, the attachment is being parsed as email instead as attachment HOT 2
- Ignore warnings - Email content 'calendar' not handled HOT 4
- Mime Header Decoding (RFC 2047) does not correctly resolve in case the display name contains an encoded comma
- from_ attribute contains two tuples for one sender
- mail format
- Is this able to parse latest reply? HOT 1
- Handle multi part/ alternative text emails? HOT 1
- Only parses Undelivered message for emails with bounced emails
- Make the specific receiver of the email available in a field HOT 1
- Extracting mail signature HOT 1
- Disable json indent by default
- newline breaks test
- Empty metadata when using mail-parser to parse .msg outlook emails (email-outlook-message-perl 0.918-2) HOT 1
- Issue when parsing an email message HOT 2
- CID not have a image data
- UnicodeDecodeError when parsing email with "\u" in its body HOT 2
- parse_from_bytes() not working on BytesIO() object HOT 1
- MailParserReceivedParsingError when parsing email domains ending in .id (Indonesia's .co.id and similar)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mail-parser.