Sending Love Letters the Linux Way

Greetings! I go by the name Akash Mishra and I'm currently pursuing my undergraduate studies with a focus on Web Development. Lately, I've embarked on a journey of contributing to Open Source projects. In my upcoming blog posts, I intend to delve into the realms of Web Development and Data Structures and Algorithms (DSA).
Introduction
Emails have long been the heart and soul of digital communication, and Linux enthusiasts know that even in the world of terminal commands, expressing digital affection is possible. In this quirky yet informative guide, we'll explore how to send emails in Linux using nothing but the command line. Get ready to add some pizzazz to your correspondence and charm your inbox with a touch of CLI magic.
Why Send Emails in the Terminal?
Unleashing your inner hacker while sending heartfelt messages.
Setting the Stage: Preparing Your Environment
Before sending the emails, we have to install some packages
- First, we will install the mail package. To install it, the command is
sudo apt-get install mailutils
Open Gmail, click on your Google Account, and then select "Manage Account."

Go to "Security"

Turn on your "2-step Verification"

Now you need your "App password", for that click again on "2-step Verification"
Scroll down and you will find the "App password".

Click on it and you'll get this

In "Select app" choose "Mail" and in "Select device" choose others. Give any name you want and then click "Generate"
Copy the code you have, as we will be using it later.
To turn on IMAP, click on the gear icon and then "See all settings

Click on "Forwarding and POP/IMAP"

And enable the IMAP

Now we will change the config file so we can send emails
Open your Linux terminal
We will be working with the Root user, so change the user to Root using this command. Then open the config file at /etc/ssmtp.conf
sudo su //change user to root cd /etc/ssmtp nano ssmtp.conf
- Now enter your details in the file
root="Your email-id"
AuthUser="Your email-id"
AuthPass="Key Generated from the App password"
Dont delete any other command
Save the file using "Ctrl X" and then press "Y"
Creating Email
Before sending an email, here are certain syntaxes you should know
Compose an email by typing the following command and pressing Enter:
mail -s "Subject"
Enter the recipient's email address:
To: "Recipient's email address"
Enter any additional recipients for the carbon copy (CC):
Cc:
Type the body of the email and provide your message.
After composing the email, press "Ctrl + D" to send it. If no output is displayed in the terminal, it indicates a successful sending.
If you want to attach any file then use
mail -s "Subject" -A filename
Conclusion
By the time you've finished reading this guide, you'll not only be able to send emails from your terminal but also add your flair to the art of digital communication. Whether you're sending a love letter, a quirky joke, or a business proposal, Linux command-line emailing is a skill that will set you apart and bring a smile to your face every time you press that enter key.
I appreciate your reading, buddy. Please like, comment on, and share this post if you find it beneficial.
Connect with me on :



