![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A versatile IMAP mail monitoring module with Gmail API support, regex queries, and flexible search options
Email Monitor is a Python module designed for monitoring and searching emails using the IMAP protocol. It is particularly useful for tasks such as OTP code scraping for web automation, email parsing, and email notifications.
This module is primarily focused on Gmail using OAuth2 for authentication, but it can also work with other IMAP email providers. It is currently in beta, so please report any bugs or issues you encounter, I would greatly appreciate it!
You can install the Email Monitor module using pip:
pip install email-monitor
The Email Monitor module is a Python library that enables you to efficiently search, parse, and monitor emails in your mailbox. By providing an intuitive interface for email handling, this module simplifies the process of obtaining specific information from your emails, such as OTP codes, notifications, or important updates.
Some of the key use cases for this module include:
Email Monitor is primarily designed to work with Gmail using OAuth2 authentication, but it can also support other IMAP email providers. To set up Gmail OAuth2 authentication, follow these steps:
credentials.json
file for your newly created OAuth 2.0 clientHere's a quick example of how to use the Email Monitor module:
from email_monitor import EmailMonitor
import re
monitor = EmailMonitor(credentials_file="credentials.json")
email = monitor.search_mail(
query={
"subject": "Your OTP Code",
"from": "noreply@example.com",
"text": re.compile("OTP: \d{6}")
},
wait_for_match=True,
unread=True,
labels=["INBOX"],
delay=10
)
print(email)
Take a look at the examples folder for more examples of how to use this module.
The search_mail
function has several parameters that can be used to customize your search:
query
(dict): A dictionary containing the search query. The keys are the search parameters and the values are the search terms. Regex is supported.
Example: {"subject": "Hello", "from": "John Doe", "to": "myOtherMail@gmail.com", "text": re.compile("Hello World")}
wait_for_match
(bool): If set to True, the function will wait for a new email to match the query and return it.
unread
(bool): If set to True, the function will search for emails that have already been read.
labels
(list): A list of labels to search for. Only works with Gmail.
delay
(int): The delay in seconds between each search if wait_for_match
is set to True.
Contributions are welcome! Feel free to submit pull requests with bug fixes or new features. Check out the contributing guidelines for more information.
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions or suggestions, feel free to reach out to me:
FAQs
A versatile IMAP mail monitoring module with Gmail API support, regex queries, and flexible search options
We found that email-monitor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.