Linux command mail
The mail
command in Linux is a simple email client that allows you to send and receive email messages. Here are some basic commands and options:
Sending an email
mail -s "Subject" [email protected]
: Send an email with a subject and body.mail -s "Subject" [email protected] < message.txt
: Send an email with a subject and body from a file.
Receiving email
mail
: Check for new email messages.mail -f
: Check for new email messages and display the headers.mail -f -
: Check for new email messages and display the full message.
Managing email
mail -d
: Delete a message.mail -r
: Reply to a message.mail -f
: Forward a message.mail -s
: Save a message to a file.
Options
-s
: Set the subject of the email.-c
: Compose a new email message.-f
: Check for new email messages.-r
: Reply to a message.-f
: Forward a message.-d
: Delete a message.-s
: Save a message to a file.
Example usage
mail -s "Hello" [email protected]
: Send an email with the subject "Hello" to [email protected].mail -f
: Check for new email messages and display the headers.mail -d 1
: Delete the first message in the inbox.mail -r 1
: Reply to the first message in the inbox.
Note: The mail
command is a simple email client and does not support many features that are available in modern email clients. It is recommended to use a more advanced email client like mutt
or msmtp
for more functionality.