Nowadays, almost everyone is using email, and email has surpassed the medium of text messaging to become the most effective way of communication. Various mailing services have been established around the world that allow you to access their services on the website. Some even have apps for different platforms, such as Gmail and Outlook for Windows, Mac, and Android.
In Linux, you can use the terminal to send emails, which is indeed an efficient method. Additionally, you can use the terminal to automatically send emails, notify others, and integrate email functionality into your programs. So, in this quick guide, we cover an easy way to send emails in Linux using the command line.
In order to send emails using the command line on Linux, users need to install a mail server or proxy. In addition, Linux also provides a variety of applications to help users send emails quickly.
The "mail" command is part of the "mailutils" package. You can install it with the following command:
sudo apt update && sudo apt install mailutils—y
It launches a graphical interface in the terminal that allows you to configure the application during installation. Please follow the instructions in the operating manual to complete this step.
Now you can send mail by entering:
Mail—s "Email subject" recipient's email address
"The '--s' option is used to specify the subject. After execution, an interactive shell will open, where you can add CC and compose the email. Once completed, press the "CTRL D" key to send the email."
Sendmail application allows you to send mail using its server's SMTP (Simple Mail Transfer Protocol). Install it on your device by following these steps:
Sudo apt install sendmail-y
Configure Sendmail according to your preferences, then run the "sendmail" command to send the email.
sendmail—vThe recipient’s email address (press Enter)
Your_mail_address (press Enter)
Subject (press Enter)
Message (press Enter)
When you have finished typing your email, please type "." on the line below. Then, press "Enter" and the system will send this email to the recipient.
Mutt is a graphical interface utility that allows you to send emails via the command line. To run it, execute the following command:
sudo apt install mutt—y
mutt—s "Subject" recipient's_email_address
After executing the previous command, press "Enter" twice to confirm the email address and subject. It will then open a text file and let you type the contents of your message. After that, just exit the text file to be redirected to Mutt's interface. Finally, you can send this email by pressing "y".
Today, email plays a vital role in helping everyone connect with professionals and your office team. Therefore, Linux provides an easy way to send emails from the terminal. So, this quick guide covers all the tools you can use to send emails from the command line in Linux. Here, we explain three easy ways to send emails from your Linux terminal.
The above is the detailed content of How to send email in Linux using command line. For more information, please follow other related articles on the PHP Chinese website!