Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't parse the '@' sign in subject emails #5

Closed
HandyGuySoftware opened this issue Oct 24, 2017 · 2 comments

Comments

Projects
None yet
1 participant
@HandyGuySoftware
Copy link
Owner

commented Oct 24, 2017

dcurrey8h
So far the only issues I have seen with very small test is I can’t change the srcdestdelimiter setting. I have tried _ @ # all cause errors. In fact if it tries to parse any message with the @ in the subject errors are produced.

Since this was my own mailserver I just filtered the mails from Duplicati into its own folder and had dupreport use that.

This is Ubuntu 16.04 testing using dovecot and postfix

Had a chance to look at the @ in subject again. I think it might be unique to some mail clients. Sogo mail was creating the issue but it would accept same message from horde and roundcube webmail clients.

For example message with the subject of "this is a message with @ in subject’’

Sogo headers would look like.

User-Agent: SOGoMail 3.2.10
MIME-Version: 1.0
Date: Mon, 23 Oct 2017 15:04:46 -0400
Subject: this is a message with =?utf-8?q?=40?= in subject
Message-ID: 476-59ee3d80-b-1881d5c0@267997335
The other two clients leave it alone

Subject: this is a message with @ in subject
Errors that happen

Traceback (most recent call last):
File "./dupReport.py", line 856, in
process_mailbox_imap(mailBox)
File "./dupReport.py", line 734, in process_mailbox_imap
mParts = process_message(msg) # Process message into parts
File "./dupReport.py", line 480, in process_message
msgParts['sourceComp'] = re.search(srcRegex, msgParts['subject']).group().split('-')[0]
AttributeError: 'NoneType' object has no attribute 'group'

Looking at the code it looks like the “-” is hard coded on line 478 and 479.

Shouldn’t that be something like

msgParts['sourceComp'] = re.search(srcRegex, msgParts['subject']).group().split(options['srcdestdelimiter'])[0]
msgParts['destComp'] = re.search(destRegex, msgParts['subject']).group().split(options['srcdestdelimiter'])[1]
@HandyGuySoftware

This comment has been minimized.

Copy link
Owner Author

commented Oct 24, 2017

Fixed statements at lines 478/479 as indicated. Worked is srcdestdelimiter was found in subject. BUT, uncovered another bug if Subject text matched but srcdestdelimiter was not in line. Things to fix:

  • Subject found but no delimeter found
  • Subject found and regex special character also found (e.g., '*')
@HandyGuySoftware

This comment has been minimized.

Copy link
Owner Author

commented Oct 24, 2017

Fixed two related issues:

  • Subject found but no delimiter found. Program now abandons message with a level 2 log message.
  • Regular expression used as delimiter character. Delimiter character now escaped by using re.escape() around variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.