Linux Mail Mail sending

Source: Internet
Author: User

Linux Mail Introduction

Under the Linux system we can send mail through the "Mail" command, in operations we usually do it to implement email alerts.

Installation

Yum Install--ymailx.i686
Start: Service SendMail start
NETSTAT-LNP | grep:00127.0. 0.1:0.0. 0.0 1102/00 ::1:1102/master
viewing the Listening port

Grammar

Mail (options) (parameters)
Options
-b< address >: Specify the recipient address of the blind copy,-c< address >: Specify the recipient address of the copy,-f< mail File >: Reads the message from the specified message file;  I: Do not display the information sent by the terminal;-I: Use interactive mode;-N: When the program is used, the settings in the Mail.rc file are not used;-N: When reading a message, the title of the message is not displayed;-s< message subject >: Specify the subject of the message;-u< user account >: Reads the message of the specified user;-V: Displays detailed information when executed.

Instance one (Basic operation)

" Hello from linuxde.net by Shell " [email Protected]hello,  This  is The content of Mail.welcome to Www.linuxde.net description: The    first line is the input command,-S indicates the subject of the message, and the following [email protected] is the recipient of the message, Enter after this line of command, enter the message body will be written, we can enter any text, such as the above two lines. When the message body input is completed, you need to press Ctrl+d to end the input, you will be prompted to enter the CC address, that is, the mail cc address, no direct return to complete the message sent.
use shell directly as editor
" hello,this is the content of Mail.welcome to Www.linuxde.net " " Hello from linuxde.net by pipe " [Email protected] Description: Use the pipeline directly into this line of command to complete the delivery of the message, where ECHO is the message body. 
send a message by using a pipeline
" Hello from linuxde.net by file " [Email protected] < mail.txt Description:    using the above command, we can send the contents of the Mail.txt file as the content of the message to [email protected]. 
use a file to send a message

Instance two (advanced operation)

Using the above three methods can be sent to the external mailbox mail, but because the previous 2 is directly in the shell to type the contents of the message, and therefore cannot input Chinese, even if we use paste to enter the Chinese language, then received the message is garbled. But the 3rd way, we can edit the contents of the message under window, put it under Linux, and then send, so that the normal delivery of Chinese. However, the current mail in the Chinese title has not found a solution.
" Hello from linuxde.net with sender " [Email protected]---f [email protected]<-F [email protected] Such parameters, this is the SendMail option, where-F represents the sender email address of the message.
send a message using a specific sender
" Hello,see the Attachement " [Email protected]<mail.txt Description: After the completion of the Text.txt file can be sent out as an attachment to the message. Uuencode has two parameters, the first is the file to be sent, and the second is the name of the file to be displayed. 
send attachments using the Mail command

Linux Mail Mail sending

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.