In Linux, you can use the terminal to send the emails; it is indeed an efficient method. Furthermore, you can use the terminal to automate the emails, notify others, and integrate the emailing functionalities in your programs. So, in this quick guide, we included a simple approach to sending emails using the command line in Linux.
How to Send Emails Using the Command Line in Linux
Linux requires installing a mail server or agents to send the mail using the command line. Certainly, it supports various applications to send the emails quickly.
1. The Mail Command
The “mail” command is a part of the “mailutils” package. You can install it through the following command:
It opens a graphical interface inside the terminal to set up the application during installation. There, you need to follow the onscreen instructions to complete the process.
Now, you can send a mail by entering the following command:
The “-s” option is solely used to specify the subject. Upon execution, it opens an interactive shell where you can add CC and compose the mail. Then, you can press the “CTRL + D” keys to send it.
2. Sendmail
The Sendmail application lets you send the mail using its server’s SMTP (Simple Mail Transfer Protocol). Go through the following steps to install it on your device:
Configure Sendmail according to your preferences and run the “sendmail” command to send an email.
Your_mail_address (press Enter)
Subject (press Enter)
Message (press Enter)
When you are done typing your message, type “.” in the following line. Then, upon pressing “Enter”, your system will send this mail to the recipient.
3. The Mutt Command
Mutt is a graphical interface utility that allows you to send the emails through the command line. To run it, go through the following commands:
mutt -s "Subject" recipient's_email_address
Upon executing the previous command, press “Enter” twice to confirm the email address and subject. It then opens a text file to let you type the mail content. After that, just exit the text file to be redirected to Mutt’s interface. Finally, you can send this email by pressing “y”.
Conclusion
Nowadays, emails play an essential role in helping everyone contact the professionals and your office team. Hence, Linux offers a simple way to send emails from the terminal. Thus, this quick guide is all about the tools that you can use to send emails using the command line in Linux. Here, we explained the three simple methods to send emails from your Linux terminal.