Linux with mail to send (super simple) __linux

Source: Internet
Author: User
Tags auth

The easiest way to send a Linux email

Recently want to monitor the system through the Linux situation and automatic alarm, the general Linux to send the alarm mail through the local mailbox or external mailbox server, here with the simplest way to achieve Linux using the external mailbox can send mail function, you simply register a domestic mail service provider, such as 163, You can also use the company mailbox, you need to install the MAILX tool, MAILX is a small mail-sending program.

The specific steps are as follows:

1, installation

[root@001 ~]# Yum Install Mailx

2, edit the configuration file

[root@001 ~]# vim/etc/mail.rc #添加如下内容

Set from=xxxx@126.com

Set smtp=smtp.126.com

Set smtp-auth-user=xx@126.com

Set Smtp-auth-password=xxx

Set Smtp-auth=login

---description

From: The sender that appears when the other person receives the message

SMTP: Specify SMTP server addresses for third party outgoing messages

Set Smtp-auth-user: User name for third party outgoing mail

Set Smtp-auth-password: User name corresponding to the password, some mailboxes are filled with authorization code

Smtp-auth:smtp authentication method, the default is login, can also be changed to CRAM-MD5 or plain mode

3, testing

[root@001 ~]# mail-s "HESAUCAQ" 83xx@qq.com </etc/passwd

[root@001 ~]# echo "Test Message" | Mail-s "Test" 83xx@qq.com

The above has implemented the email function ...

In the case of: 554 DT:SPM sent the content of the message contains not NetEase license information, or violate NetEase's anti-spam terms, you can send their own mailbox.

1) No message body

Mail-s "Subject" Inbox address

% mail-s "Test" 1968089885@foxmail.com

2 There is the message body mail-s "subject" Inbox address < file (message text. txt)

% mail-s "Mail Subject" 1968089885@foxmail.com </data/findyou.txt echo "message body" | Mail-s Mail Subject Address

% echo "message body content" | Mail-s "Mail Subject" 1968089885@foxmail.com cat message body. txt | Mail-s Mail Subject Address

% Cat/data/findyou.txt | Mail-s "Mail Subject" 1968089885@foxmail.com

3) with Attachment Mail-s "subject" address-a Attachment < file (message text. txt)

% mail-s "Mail Subject" 1968089885@foxmail.com-a/data/findyou.tar.gz </data/findyou.txt reprinted from: https://www.cnblogs.com/ Imweihao/p/7250500.html


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.