Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Python imap_ssl.search one letter name

It takes a bit of digging to find the details of IMAP search criteria : https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4
Indeed the FROM returns all entries containing the specified string, as you already found. It doesn't say if you can use regular expressions, so that you could use "$a^". It's worth a try. Otherwise you need to loop through the result list and pick out the ones that exactly match a.
 
It takes a bit of digging to find the details of IMAP search criteria : https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4
Indeed the FROM returns all entries containing the specified string, as you already found. It doesn't say if you can use regular expressions, so that you could use "$a^". It's worth a try. Otherwise you need to loop through the result list and pick out the ones that exactly match a.
Thank you for the IMAP search criteria info!

I attempted to discover anything common among his spam, and unique amongst other spammers, only one thing so far, in the HEADER.

I'm having a hard time with the syntax for the Header fields:
HEADER <field-name> <string>

field-name is: Authentication-Results
string is: header.i=@

What I have, but syntax is wrong, could use some help on this please:
Python:
resp_code, mails = imap_ssl.search(None, '(HEADER "Authentication-Results" "header.i=@")')
header.png

I'm not even sure that small snippet from the field-name will work!
 
I am having a hard time with the imaplib select and fetch calls as well... Bah, this is so badly documented with hardly an explanation or example. Good working examples are very hard to find. I saw someone remark that imaplib is a good library, but it's IMAP itself that is incomprehensible. I feel like giving up and saying I can't help you 😳
 
I must confess not having thought about this anymore, since my last dig in the documentation got me more confused and infuriated than ever.
Are you still struggling with it ?
 
I was so stressed over this, I ended up paying a programmer.
He wrote 5 lines of code, and it does exactly what I needed!
Thank you for checking in!
Ok :)
It should have been an easy task... and lord knows we tried....if only the documentation wasn't so atrocious 😯
Good that you found someone who evidently knows this stuff.
 
Back
Top Bottom