Email_Notifier
is a Python-based template designed to monitor specific events or data and send email notifications to users.
This template is highly customizable and can be easily adapted to monitor other types of data or events, making it a versatile starting point for building email-based notification systems.
- Monitor GitHub users for newly created repositories.
- Send email notifications with details, including clickable repository links.
- Easy configuration using environment variables (
.env
file). - Modular and well-structured code for easy adaptation to other use cases.
-
Clone the repository:
git clone https://github.com/doin4/Email_Notifier.git cd Email_Notifier
-
Install dependencies:
pip install -r requirements.txt
-
Configure the .env file with your settings:
USER_LIST=target,uer,name,no,space # You can run the script without your token GITHUB_TOKEN=your_personal_access_token EMAIL_SENDER=[email protected] EMAIL_PASSWORD=your_email_password EMAIL_RECEIVER=[email protected] # Change the server and port accroding to your sender email SMTP_SERVER=smtp.qq.com SMTP_PORT=465 TRACKED_REPOS_FILE=/path/to/your/own/save
-
Run the script manually:
python main.py
Note: Accroding to my test, the following error does not indicate error in sending email.
Error sending email: (-1, b'\x00\x00\x00')
-
(Optional) Schedule automatic monitoring:
- Linux/Mac: Use
cron
orcrontab
to schedule the script to run periodically. - Windows: Use Windows Task Scheduler to schedule the script.
- Setup: Configure the
.env
file with GitHub usernames, email credentials, and other required settings. - Monitoring: The script fetches the list of repositories for specified GitHub users using the GitHub API.
- Detection: It compares the current repository list with previously tracked repositories stored in a JSON file.
- Notification: If new repositories are detected, an email notification is sent to the configured recipient.
This template is designed for monitoring GitHub repositories, but you can easily adapt it to monitor other types of data or events. For example:
The script fetches the list of repositories for specific GitHub users and detects new repositories. When a new repository is detected, it sends an email notification.
To modify this template to monitor weather conditions:
- Replace the GitHub API logic (
fetch_user_repos
) with a weather API (e.g., OpenWeather API) to fetch weather data. - Update the logic in
check_new_repos
to monitor for specific weather conditions (e.g., rain, snow). - Update the email body to include the relevant weather information.