Skip to content

M2hmoud2del/flask_email_sender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Flask Email Sender (CLI Tool)

A simple command-line Python tool to send emails using Flask-Mail.

This project demonstrates how to configure and use Flask-Mail to send emails via Gmail's SMTP server, with credentials loaded securely from environment variables.

Features

  • Send plain text emails using a Gmail account.
  • CLI-based input (no HTML or frontend needed).
  • Uses a .env file for credentials.

Getting Started

1. Clone the Repository

git clone https://github.com/M2hmoud2del/flask_email_sender.git
cd flask_email_sender

2. Create and Activate a Virtual Environment

python -m venv venv
# On Linux/macOS:
source venv/bin/activate
# On Windows:
venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Create a file named .env in the root of the project and add your Gmail credentials:

MAIL_USERNAME=your_email@gmail.com
MAIL_PASSWORD=your_app_password

Important: If you have 2FA enabled on your Gmail account, you will need to use an App Password instead of your regular password. You can generate one from your Google Account settings.

Usage

Run the program:

python app.py

You will be prompted to enter:

  • Recipient email
  • Email subject
  • Email body

Example:

Recipient Email: test@example.com
Subject: Hello
Message Body: This is a test email.

Project Structure

flask_email_sender/
├── app.py              # Main script to send email
├── .env                # Environment variables
├── requirements.txt    # Python dependencies
└── README.md           # Project documentation

License

This project is open source and free to use under the MIT License.

Author

Developed by Mahmoud Adel GitHub: https://github.com/M2hmoud2del

LinkedIn: https://www.linkedin.com/in/mahmoud2del

Website: https://mahmoudadel.social-networking.me

About

A simple command-line tool built with Flask-Mail to send emails using Gmail SMTP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages