473,320 Members | 2,189 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Imaplib [search, move, delete] Yahoo Mail

4 2Bits
Any python experts willing to share there knowledge, please?!

Want to:
1. Search ALL folders including SPAM, for "specific_user@ANY (wildcard) domain"
2. Move those emails to folder called DUMP
3. Delete contents of DUMP

Unfortunately I can't figure out how to do what I need above in Yahoo Mail!

My code so far below:


Expand|Select|Wrap|Line Numbers
  1. import imaplib
  2. import time
  3.  
  4. ####### IMAP SSL #######
  5. start = time.time()
  6. try:
  7.     imap_ssl = imaplib.IMAP4_SSL(host="imap.mail.yahoo.com", port=993)
  8. except Exception as e:
  9.     print("ErrorType : {}, Error : {}".format(type(e).__name__, e))
  10.     imap_ssl = None
  11.  
  12. print("Connection Object : {}".format(imap_ssl))
  13. print("Total Time Taken  : {:,.2f} Seconds".format(time.time() - start))
  14.  
  15.  
  16. ####### Login to Mailbox #######
  17. print("Logging into mailbox...")
  18. try:
  19.     resp_code, response = imap_ssl.login("XXXXXXX@yahoo.com", "XXXXXXXXXXX")
  20. except Exception as e:
  21.     print("ErrorType : {}, Error : {}".format(type(e).__name__, e))
  22.     resp_code, response = None, None
  23.  
  24. print("Response Code : {}".format(resp_code))
  25. print("Response      : {}\n".format(response[0].decode()))
  26.  
  27.  
  28. ####### Missing code to search, move and delete #######
  29.  
  30.  
  31.  
  32.  
  33. ####### Logout of Mailbox #######
  34. print("\nLogging Out....")
  35. try:
  36.     resp_code, response = imap_ssl.logout()
  37. except Exception as e:
  38.     print("ErrorType : {}, Error : {}".format(type(e).__name__, e))
  39.     resp_code, response = None, None
  40.  
  41. print("Response Code : {}".format(resp_code))
  42. print("Response      : {}".format(response[0].decode()))
Aug 19 '22 #1
0 3931

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Stanley | last post by:
Hi, I'd like to write a HTML page which can help me directly log in my Yahoo!mail or Gmail account without typing user name and password. Basically, I want to set up a link, click it and pop up...
2
by: cvillard | last post by:
So I have a query... Yahoo mail uses a button that has two functions. If you click on the major portion it will launch your search. If you click on the image that is on the right of the button (...
6
by: erdem kemer | last post by:
i cant send mail to yahoo mail or hotmail while i can send my other mail accounts (pop3) is it becouse yahoo and hotmail is web-based mail here is the code MailMessage mailMsg = new...
3
by: T | last post by:
Is there a way to access yahoo mail via its web interface? If so, can someone give some pointers?
2
by: Kenneth Porter | last post by:
If you email your users links and wrap the links in angle brackets, beware users using Yahoo Mail. It includes the trailing angle bracket in the link, preventing it from working. (This was...
4
by: cybervigilante | last post by:
I sent HTML formatted email, using PHP, to my Yahoo address from my server, and it came out fine, styles and all. I sent it to my gmail address to test it and all I see is the raw html code. But I...
6
by: santosh123 | last post by:
i need to bypass the yahoo login page using asp.net and C#. i want to send the login credential through my program and the output should be the inbox of the yahoo mail. plz.. help...
8
AmberJain
by: AmberJain | last post by:
I'm having an mail account on yahoo mail. I formatted my HDD 3 days ago and reinstalled windows XP professional SP2. My problem is that I'm unable to attach any files to any of outgoing mail in my...
5
by: muddasirmunir | last post by:
I want to ask question about yahoo mail. I had created a new email id with the name of my company let say maycompany@yamail.com Now, while making email I put my name in the fields asked by...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.