Andrea FreeSmarterTools Inc.877-357-6278www.smartertools.com
Long story short, search is challenging for generic IMAP accounts. It’s probably not the answer you were hoping for, but hopefully it gives you a good idea of the challenges we are facing and the tradeoffs we must make as a small company who wants to provide a feature-rich application that‘s also cost-effective (both for us and our customers). An IMAP extension we know that can significantly improve search is SEARCH=FUZZY: https://tools.ietf.org/html/rfc6203 Unfortunately few independent email providers support it, at least by default. Some providers run installations of Dovecot that support SEARCH=FUZZY but those are rare. Dovecot is the most popular IMAP software. It supports SEARCH=FUZZY since version 2.1, but the extension must be manually enabled: https://imapwiki.org/Specshttps://doc.dovecot.org/configuration_manual/protocols/imap_server/https://doc.dovecot.org/configuration_manual/fts/ These links are the relevant documentation pages you could send to your hosting provider as reference.
import imaplib import pprint import timeit imap_host = 'mail.example.com' imap_user = 'email@email.com' imap_pass = 'password for email' # connect to host using SSL imap = imaplib.IMAP4_SSL(imap_host) imap.login(imap_user, imap_pass) def imapconnection(): imap.select('Inbox') tmp, data = imap.search(None,'FROM' , 'emailtosearchfor@gmail.com') for num in data[0].split(): tmp, data = imap.fetch(num, '(RFC822)') #print('Message: {0}\n'.format(num)) #pprint.pprint(data[0][1]) break #save the execution time to a list execution_time_list = [] i = 0 while i < 100: execution_time = timeit.timeit(imapconnection, number=1) execution_time_list.append(execution_time) i += 1 #print the average execution time from the list print(sum(execution_time_list)/len(execution_time_list)) imap.close()
imap = imaplib.IMAP4_SSL(imap_host)
imap = imaplib.IMAP4(imap_host) imap.starttls()
Trouble logging in? Simply enter your email address OR username in order to reset your password.
For faster and more reliable delivery, add noreply@smartertools.com to your trusted senders list in your email software.