How to use mail command in Centos system
In this issue, Xiaobian will bring you about how to use mail commands in Centos system. The article is rich in content and analyzed and described from a professional perspective. After reading this article, I hope you can gain something.
1. mail basic syntax
h| headers Displays the current mailing list
l| list Displays a list of currently supported commands
?| help Show multiple commands to view mailing lists Parameters Usage
d Delete the current message, pointer and move down. d 1-100 Delete messages 1 to 100
t| type| more| p| num page Read an email
n| next| {Nothing} Read the content of the next email where the current pointer is located; when reading, press the Space key to turn the page, press the Enter key to move down one line
n| next| {Nothing} num Read an email
f| from num View header
top Displays the header of the message where the current pointer is located
file| folder displays the path and number of messages stored by the entire user
Press Ctrl+D when you are done editing the text. key end text
Q to quit
2. Mail storage location:
/var/spool/mail/username
3. Three ways to send mail:
1). Standard Input Enter Email Content:
mail -s "title" username@domain.c
Press Ctrl+D or. key end text
2). of output
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 how the mail command shared by Xiaobian is used in Centos system. If you happen to have similar doubts, you may wish to refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.