In this article, we will look at how to fetch a fixed number of recently sent e-mails via a Gmail account using Python.
The libraries used in this implementation include
In the setting page, enable this before running the script.
- Import the
- Establsih a imap connection with the Gmail account.
- Instantiate the username and password variables for the Gmail account.
- Login into the Gmail account
- Select the sent mails.
- Determine the number n of sent e-mails to be retrieved.
- Iterate the n e-mails and print the sender and the subject of the e-mail.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course