How does the Linux system send mail?

  

The characteristic of Linux system is that any operation can be implemented by commands. Linux system can also send mail by command. This article will introduce how the Linux system sends mail?

can send and receive mail using the mail command syntax is as follows:

$ mail [-s subject] [-c cc-addr] [-b bcc-addr] to- Addr

The meaning of each option is as follows:

Option Description

-s The message header.

-c For users to send, multiple users are separated by a comma (,).

-b For users who need to send secrets (bcc), multiple users are separated by commas (,).

For example, send an email to [email protected]:

$mail -s “Test Message” [email protected]

Hello everyone,

this is Linux tutorial and url is http://see.xidian.edu.cn/cpp/linux/.

Cc:

The first line is the command to enter, -s is the subject of the message, and the [email protected] is the recipient of the message. The car will enter the body of the mail, you can enter any text, such as the two lines above. After inputting the body of the email, you need to press CTRL+D to end the input. At this point, you will be prompted to enter the Cc address, which is the email copy address. The email is sent without a direct carriage return.

You can also send the file via the redirection operator:

$mail -s “Report 05/06/07” [email protected] demo.txt

With the above command, you can send the contents of the demol.txt file to [email protected] as the content of the email.

No parameters are required to receive mail:

$mail

no email

The above is the introduction of the Linux system to send mail, of course you You can log in to the mailbox to send mail in the browser, but as long as you are familiar with using the command to send mail, it is actually more convenient.

Copyright © Windows knowledge All Rights Reserved