This repository contains a Python script that facilitates the sending of emails directly from the command line. Leveraging the power of Python's smtplib and email libraries, the script provides a user-friendly interface to compose and send emails with SSL encryption for enhanced security. It includes features such as loading credentials from environment variables via the python-dotenv package, robust error handling, and logging for effective troubleshooting and operational visibility. Ideal for automating email notifications, this script offers a scalable and secure solution for integrating email functionalities into Python applications.
- Navigate to Gmail and log in.
- Click on your profile picture in the top right corner.
- Select "Manage your Google Account" from the dropdown menu.
- In the left-hand menu, click on "Security."
- In the "How you sign in to Google" section, check if 2-Step Verification (2FA) is enabled. If not, enable it to proceed.
- Visit Gmail Apps
- Under 'Select app', choose 'Other', type a custom name (e.g., Python Email App), and then click 'Generate'.
- Copy the generated app password and paste it into your .env.example file under the GMAIL_APP_PASSWORD variable.
- In the same .env.example file, set the SENDER_EMAIL and RECEIVER_EMAIL variables with your desired email addresses.
- To send a pre-defined email, modify the subject and body in the send-email.py script and run it.
- Alternatively, to send emails with dynamic content, run the send-email-dynamic-input.py script, and input the email subject and body when prompted.

