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

Error occurred [loop]: UID command error: BAD [b'Command Argument Error. 11'] #9

Open
tknikita opened this issue Sep 9, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@tknikita
Copy link

tknikita commented Sep 9, 2022

hello!

i got the following error when connect to Exchange OWA mailbox via IMAP

<2> Mail to Telegram Forwarder: Error occurred [loop]: UID command error: BAD [b'Command Argument Error. 11']. Data: b'EBCB6 UID SEARCH UID *\r\n' [/opt/rr-rps-mail-to-telegram-forwarder/mailToTelegramForwarder.py:1051 in 'main']

@arubia45
Copy link

Hello, I have the same problem with both the mail of yahoo.es/mailfence.com

Greetings.

@arubia45
Copy link

Google Mail:

<2> Mail to Telegram Forwarder: Error occurred [loop]: UID command error: BAD [b'Could not parse command']. Data: b'HCDI6 UID SEARCH UID *\r\n'

@lacrimal
Copy link

lacrimal commented Sep 19, 2022

Google mail is not 100% imap compliant, from 0.1.2 version of forwarder I'm using modification.
It will resend email from specified folder when it is marked as unread, so you can use specific filter like:
search: (UID ${lastUID}:* UNSEEN HEADER FROM "[email protected]")
my changes:

739c739,740
<         rv, data = self.mailbox.uid('search', '', 'UID *')
---
>         rv, data = self.mailbox.select(self.config.imap_folder)
>         rv, data = self.mailbox.uid('SEARCH', None, 'UNSEEN')
905c906,907
<             rv, data = self.mailbox.uid('search', '', search_string)
---
>             rv, data = self.mailbox.select(self.config.imap_folder)
>             rv, data = self.mailbox.uid('search', None, search_string)
942a945
>                 rv, data = self.mailbox.select(self.config.imap_folder)

@arubia45
Copy link

Good morning, I have made the modifications but I get the same error. I don't know if I've done them right, if you can leave me your file mailToTelegramForwarder.py complete with the modifications I would appreciate it.

Mail to Telegram Forwarder: Error occurred [loop]: UID command error: BAD [b'Could not parse command']. Data: b'KCIE6 UID SEARCH UID *\r\n'

Thank you

@lacrimal
Copy link

Here you go:
downloads.zip
./m2t --config m2t.conf

Also replace <...> tags in my m2t2.conf if you use one to suffice your needs.

Needed to install python 3.9 to get whole script to work so lookup at top interpreter declaration.

@arubia45
Copy link

Thanks

@arubia45
Copy link

Hello, with what you sent me it works for me although it only works when there is an unread email if there is more than one does not forward them to Telegram It happens to you too? Thank you

@lacrimal
Copy link

you are right - never received more than one message in one loop so never tested this issue

@lacrimal
Copy link

lacrimal commented Sep 22, 2022

Problem was when +1 messages appear, whole array was shown as UID - that was obvious error.
Now

  • every time you start, last UID is set to 1 so all unread messages will be forwarded (one or more).
  • when one or more messages are sent, they are marked as read and last UID is set back to 1 so it waits for any unread message in your 'folder'
  • you can simply mark messages as unread and they will be sent again

You can filter interesting emails by tag (folder) and additionally by any other option that IMAP query supports (look at my previous post about UNSEEN HEADER FROM).
Below is working one:
mailToTelegramForwarder.zip

@awalon awalon added the bug Something isn't working label Sep 28, 2022
fastiuk added a commit to fastiuk/MailToTelegramForwarder that referenced this issue Apr 10, 2023
fastiuk added a commit to fastiuk/MailToTelegramForwarder that referenced this issue Apr 10, 2023
@martin1551
Copy link

definitely @lacrimal patch fixes the issue. It would be cool to merge it into awalon:master as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants