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

Wait for email fails with error: UID command error: BAD [b'The specified message set is invalid.'] #28

Open
phermann-DGL opened this issue Jul 26, 2022 · 10 comments

Comments

@phermann-DGL
Copy link

While Updating from RF-ImapLibrary2 from Version 0.4.0 to 0.4.4 we are getting this error:
error: UID command error: BAD [b'The specified message set is invalid.']
In Version 0.4.0 all worked fine.

We are using Python 3.8.0 and RF 5.0.1 on Windows 10.

${email_index} = ImapLibrary2 . Wait For Email sender=${email_sender}, subject=${decoded_subject}, timeout=360, recipient=${email_recipient}, status=UNSEEN, folder=${email_folder}

As e-mail prover we are using outlook.com.
Subject is something like this: S1 Dein neues Passwort für domain.de
And the email folder: S1/ChangePassword

The Email Types are:
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

@lasselindqvist
Copy link
Owner

I will happily merge a fix if you happen to find out the reason.

@MarcusWx
Copy link

We had the same issue, it seems only to occur when providing the 'subject' argument. We have the impression that the handling of 'subject' in init.py might be the issue.

@MarcusWx
Copy link

In fact we had a slightly different error message: BAD [b'Invalid search criteria']. But the underlying cause is probably the same: the order in which criteria for the email you want to retrieve are tested. The combination status=UNSEEN/Subject=<subject_search_criteria> then fails. The search criteria are stringed in an unsupported order.

We present the following patch for version 0.4.4. It has passed successfully for our specific test cases and high level regression testing has been done.

--- init.py.orig 2022-08-19 14:19:18.864095455 +0200
+++ init.py 2022-08-26 13:52:21.935202256 +0200
@@ -458,12 +458,12 @@
criteria += ['CC', '"%s"' % cc]
if text:
criteria += ['TEXT', '"%s"' % text]

  •    if subject:
    
  •        criteria += ['SUBJECT']
       if status:
           criteria += [status]
       if not criteria:
           criteria = ['UNSEEN']
    
  •    if subject:
    
  •        criteria += ['SUBJECT']
       return criteria
    

    def _init_multipart_walk(self):

@lasselindqvist
Copy link
Owner

If someone could open a PR with that patch, I'd happily merge and release.

@MarcusWx
Copy link

MarcusWx commented Sep 2, 2022

I have made a merge request for _init.py on behalf of imap-search order change

@lasselindqvist
Copy link
Owner

Merged. I will try to release this weekend.

@lasselindqvist
Copy link
Owner

@lasselindqvist
Copy link
Owner

Will close this issue once @phermann-DGL or someone else can confirm the fix in release works.

@MarcusWx
Copy link

MarcusWx commented Sep 9, 2022

Thanks for the release! We have tested the 0.4.5 fix with our test cases. Works fine now, maybe @phermann-DGL could confirm?

@phermann-DGL
Copy link
Author

Now we get another error:
Get Links From Email -> TypeError: decode() argument 'encoding' must be str, not None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants