The "mail" command is a simple command-line utility in Linux and Unix-like operating systems that allows you to send and receive emails from the command line. It uses the Simple Mail Transfer Protocol (SMTP) to send emails and the Post Office Protocol (POP3) or the Internet Message Access Protocol (IMAP) to receive them.
To send an email using the "mail" command, you can use the following syntax:
r refeto:lautturi.commail -s "subject" recipient@example.com
Replace "subject" with the subject of the email and "recipient@example.com" with the email address of the recipient. After running the command, you will be prompted to enter the body of the email. Press Enter after each line to create a new line, and press Ctrl+D when you are done writing the email to send it.
To receive emails with the "mail" command, you need to first configure your email account by specifying the server and port for the incoming and outgoing mail, as well as your username and password. This can be done by editing the /etc/mail.rc file or by setting the appropriate environment variables.
Once your email account is configured, you can use the following command to retrieve your emails:
This will list the emails in your inbox, along with their subject and sender. To read a specific email, enter the number of the email (e.g., "1" to read the first email). You can use the "d" command to delete an email, the "u" command to mark it as unread, and the "q" command to quit the "mail" program.
Note: The "mail" command may not be installed by default on all Linux and Unix systems. If it is not available, you can install it using the package manager of your operating system (e.g., apt-get on Debian and Ubuntu, yum on CentOS and Fedora, etc.).