Newbie School: test the mail command in Linux

Source: Internet
Author: User
Article Title: newbie School: test the mail command in Linux. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories 1. The simplest example:
 
Mail-s test yangfang@fudan.edu.cn
 
The result of this command is to send an empty letter named test to the mailbox behind it. If you have an mta and the mailbox behind it won't block this strange message, you will be able to receive this letter. If you do not want to be disturbed by such a mess, use a local account for your mailbox.
 
2. Example 2:
 
Send emails in three common formats
 
Mail-s test yangfang@fudan.edu.cn # The first method, you can use the current shell as the editor, edit the content after Ctrl-D end
 
Echo "mail content" | mail-s test yangfang@fudan.edu.cn # the second method, I use the most, may be like the reason for Pipeline
 
Mail-s test yangfang@fudan.edu.cn <file # The third method, mail with file content as the mail content
 
In fact, you can easily find that mail reads the file content from the standard input and sends a mail. I just want to let you know this. Here, the second example ends.
 
3. In the third example, emails with attachments
 
If you do not have the uuencode command in your system, install sharutils (yum install sharutils) first)
 
Uuencode requires two parameters. The first one is the file you want to send (you). Of course, this can also be done using pipelines, and the second one is the file name displayed.
 
Uuencode/home/yfang/a.gif | mail-s pictest yangfang@fudan.edu.cn
 
Tar czf-/home/yfang/| uencode home. tgz | mail-s pictest yangfang@fudan.edu.cn
 
Ps: By the way, the mail in slackware seems to have a-a parameter. You can add attachments directly. I have never used it.
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.