Python Forum
imap_ssl.search one letter name
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
imap_ssl.search one letter name
#1
resp_code, mails = imap_ssl.search(None, '(FROM "a")')
I want to search emails from a specific one letter named user, "a".
Example:
<a@xxxxx.com>
<[email protected]>


Problem is, search results cause all users with an "a" as part of there name to be returned.
Example:
jane@xxxxx.com
[email protected]

Any way to isolate the search to one letter name?
Reply
#2
Looks like it's not directly possible. The search is done on the server, and there's no way to tell it to not match partials. You'd have to accept that the search may return more than you want. Then loop over all the results and toss the ones you don't want.
Linh_lee likes this post
Reply
#3
(Aug-23-2022, 06:41 AM)bowlofred Wrote: Looks like it's not directly possible. The search is done on the server, and there's no way to tell it to not match partials. You'd have to accept that the search may return more than you want. Then loop over all the results and toss the ones you don't want.

I was afraid of that!

You see, I'm scanning emails from a spammer that has a one letter name, and spoofed domains....50+ per day, non stop for over 4 months!
I hate to just blindly delete Spam folder contents, that's why I need the specific search and delete.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020