Linux sends mail settings using mail

Source: Internet
Author: User

Linux uses mail to send mail

The first step checks whether the Mail command is installed

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/78/86/wKioL1Z_TY3gOkdmAAAcGL1tLtQ622.png "title=" Zabbix-mail.png "alt=" Wkiol1z_ty3gokdmaaacgl1tltq622.png "/> Second step if setting Mailx SMTP

Set [email protected]

Set smtp=smtp.163.com

Set Smtp-auth-user=myname

Set Smtp-auth-password=password (client authorization password)

Set Smtp-auth=login


Step 163 mailbox Open SMTP POP3

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/78/87/wKiom1Z_TlmQBhTiAADge8-9ol0460.png "title=" image 201512272.png "alt=" Wkiom1z_tlmqbhtiaadge8-9ol0460.png "/>





Note: Generally send yourself to yourself. There may be a problem sending to another account.

Test of the Mail command under the Linux system

Send mail

1. One of the simplest examples:

Mail-s test [email protected]

The result of this command is to send an empty letter titled Test to the back of the mailbox, if you have an MTA and the back of the mailbox will not block this potentially inexplicable letter, you can receive this letter. If you don't want to be distracted by this mess, use your local account in the back of the mailbox.

2. A second example:

Three commonly used formats for sending letters

Mail-s test [email protected] #第一种方法, you can use the current shell as an editor, finish editing the content ctrl-d end

echo "Mail Content" |mail-s test [email protected] #第二种方法, I used the most, probably like the plumbing for the sake of it

Mail-s test [email protected] < file #第三种方法 to send the contents of the file to the message

In fact, you can easily find that mail reads the contents of the file from the standard input and send it to you, and I just want you to know this, and the second example ends here.

3. Third example, mail with attachments

If you do not have a uuencode command in your system, please install Sharutils (yum install sharutils) first.

Uuencode need two parameters, the first is the file you want to send (we), of course, this can also be done with a pipeline, the second is the display of the filename

Uuencode/home/yfang/a.gif a.gif|mail-s pictest [email protected]

Tar Czf-/home/yfang/| Uuencode home.tgz |mail-s pictest [email protected]

PS: By the way, Slackware Mail seems to have a-a parameter, you can add attachments directly, I have not used.



Check if the message was sent successfully

Check whether the sent e-mail is delivered or stuck in the mail server

Syntax:/USR/LIB/SENDMAIL-BP

If the screen appears as "Mail queue is empty" information, it indicates that Mail has been sent out.

For other error messages, the email has not been sent for any reason.





Add:

Linux Mail Command parameters:

I ignore the interrupt signal of the TTY. (interrupt)

I forced to set into interactive mode. (Interactive)

V Print out a message, such as the location, status, etc. of the courier. (verbose)

n does not read into the Mail.rc profile.

s message header.

c cc email address.

b bcc e-mail address.


Messages received by the system will be saved in the "/var/spool/mail/[linux User name" file. When you enter mail in Linux, you have your Inbox and display a list of 20 messages.


At this point, the command prompt is "&": (You can enter the following command to work with the message)

& Help//If you don't use or forget any commands, enter Help or? To get help

Mail Commands

T print out the message "note" Multiple information is separated by a space, such as T 1 7

n Print out the next piece of information

E edit Information

f The header line of the output information

D Delete Information

s file append information to files

u do not delete a message

R Reply to Sender

R replies to the sender and all recipients of this information

Pre-reserved information at/usr/spool/mail 1*

M email, multiple recipients separated by spaces "need sendmail support"

Q quit, saving unresolved messages in mbox

x quit, do not remove system mailbox

H Print out active message headers

! Let the shell execute a command, such as!ls output ls command result

CD [Directory] Change directory, there is no!CD, but print the current directory needs!pwd


This article is from the "16 Stage Squirrel & Frog" blog, please be sure to keep this source http://tlinux.blog.51cto.com/7288656/1728721

Linux sends mail settings using mail

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.