1.Basic syntax of mail
h|headers Display the current mailing list
l|list displays the currently supported command list
?|help Display the usage of command parameters for multiple viewing mailing lists
d Delete the current email and move the pointer down. d 1-100 Delete emails 1 to 100
t|type|more|p|page num Read a certain email
n|next|{Fill in nothing} Read the content of the next email where the current pointer is; when reading, press the space bar to turn the page, and press the Enter key to move down one line
n|next|{Fill in nothing} num Read a certain email
f|from num View email header
top Display the email header of the email where the current pointer is located
file|folder displays the entire user email storage path and the number of emails
mail Write an email. After editing the text, press the Ctrl D key or the . key to end the text
q Exit
2. Email storage location:
/var/spool/mail/username
3. Three ways to send emails:
1). Standard input input email content:
mail -s "title" username@domain.c
Press Ctrl D key or . key to end the text
2).Pipeline method
echo “mail content”|mail -s “title” username@domain.c
cat somefile |mail-s "title" username@domain.c
3).File redirection method
mail -s "title" username@domain.c < file
The above is the detailed content of Detailed explanation of how to use the mail command mail in CentOS. For more information, please follow other related articles on the PHP Chinese website!