Creating a terminal-based email composer involves writing a simple program that lets the user input email details—like recipient, subject, and body—in the terminal, then composes the email and optionally sends it via an SMTP server.
Below is a Python example of a terminal-based email composer with these features:
-
Input for To, Cc, Bcc, Subject, and Body
-
Supports multi-line body input until a specific keyword (e.g., a single dot
.
on a line) -
Option to send the email using SMTP (with configurable SMTP settings)
-
Validation for email fields
How to use:
-
Save this as
email_composer.py
. -
Run
python3 email_composer.py
in your terminal. -
Input recipients, subject, and the body (end body input with a single
.
line). -
Enter SMTP details (for example, Gmail SMTP server:
smtp.gmail.com
port587
). -
The email will be sent if all details are correct.
Note:
-
For Gmail, you may need to create an app password or enable “less secure apps” (which Google has been disabling) to allow SMTP login.
-
Modify SMTP settings to your email provider’s info as needed.
Would you like me to help create a version that stores drafts or has a richer editor in terminal?
Leave a Reply