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.