Use the MAIL command in Linux

Source: Internet
Author: User

1. View Mail help information
[Root @ local ~] # Mail-H
Mail: Invalid option -- H
Usage: Mail [-iinv] [-s subject] [-c cc-ADDR] [-B bcc-ADDR] To-ADDR...
[-- Sendmail-options...]
Mail [-iinnv]-f [name]
Mail [-iinnv] [-u user]

2. Use the MAIL command to send an email
Method 1:
Char cmd [1024];
Sprintf (CMD, "mail-S/" [important] Hello, fuck the world/"% S <body.txt ---fwzhwho@162.com", "128393232@qq.com ");
System (CMD );
And body.txt is the mail content.

Method 2:
Char cmd [1024];
Char * content = "The weather in Beijing is cool !"
Sprintf (CMD, "Echo/" % S/"| mail-S/" [important] Hello, fuck the world/"% s ---fwzhwho@162.com", content, 128393232@qq.com ");
System (CMD );
Content is the content of the email.

3. For Windows, the default Chinese encoding is gb2312 (GBK), the SSH client is UTF, And the Linux is UTF. The screen is directly displayed in a Linux file, and the mail title sent by using the MAIL command is garbled.
The solution is to enable the samba service in Linux, MAP and share the file to the drive disk of windows, and directly edit files such as. C. cpp.

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.