https://github.com/appleboiy/pymail
Email Sender Python Script to sending emails via Gmail SMTP.
https://github.com/appleboiy/pymail
Last synced: about 2 months ago
JSON representation
Email Sender Python Script to sending emails via Gmail SMTP.
- Host: GitHub
- URL: https://github.com/appleboiy/pymail
- Owner: AppleBoiy
- License: mit
- Created: 2024-05-05T05:33:50.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-05T08:54:12.000Z (about 1 year ago)
- Last Synced: 2025-02-12T05:45:03.588Z (4 months ago)
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Email Sender Script
This Python script sends an email using Gmail SMTP. It loads sender credentials and recipient email address from environment variables, and the email content from a file. The script supports sending both plain text and HTML emails.
## Prerequisites
- Python 3.x installed on your system
- Gmail account for sending emails
- Enable "Less secure app access" or set up an "App password" for Gmail (if using 2-step verification)## Installation
1. Clone this repository to your local machine:
```bash
git clone https://github.com/AppleBoiy/pymail.git
```2. Install the required Python packages:
```bash
pip install -r requirements.txt
```3. Set up environment variables:
Create a `.env` file in the project directory and add the following variables:
```
[email protected]
PASSWORD_SENDER=your_gmail_password_or_app_password
[email protected]
```Replace `[email protected]` with your Gmail email address, `your_gmail_password_or_app_password` with your Gmail password or app password, and `[email protected]` with the recipient's email address.
## Usage
Run the script `main.py` to send the email:
```bash
python main.py
```## Customization
- Modify the `payload.html` file to customize the email content.
- Adjust the logging configuration in the script as needed.
- Extend the script with additional features like attachments or multiple recipients.## License
[MIT License](LICENSE)