A simple email sender application built in Python that allows you to send emails with optional image attachments using Gmail's SMTP server. The application can be run interactively or with command-line arguments.
- Send emails with or without attachments
- Interactive input for email details
- Command-line interface for quick usage
- Basic error handling and logging
- Modular structure for easy maintenance
- Python 3.x
- A Gmail account
-
Clone the repository:
git clone https://github.com/jpxoi/send_email.git cd send_email -
Install dependencies (if any):
- Currently, this application does not require any external libraries beyond the Python standard library, so no additional installation is needed.
You can run the application in two ways: interactively or with command-line arguments.
Simply run the script without any arguments:
python email_sender.pyYou will be prompted to enter your email credentials and email details.
You can also provide the recipient's email, subject, body, and an optional attachment directly from the command line:
python email_sender.py recipient@example.com "Subject Here" "Body of the email" --attachment path/to/attachment.jpegTo send an email with an attachment:
python email_sender.py recipient@example.com "Hello" "This is a test email" --attachment path/to/image.jpgTo send an email without an attachment:
python email_sender.py recipient@example.com "Hello" "This is a test email"All events, including errors, are logged to email_sender.log in the same directory as the script.
- This application currently only supports sending emails from Gmail accounts. Ensure you use a valid Gmail address.
- Make sure to allow "Less secure apps" in your Google account settings to use this application.
This project is licensed under the MIT License. See the LICENSE file for details.