Use your own mail to send mail under Linux

Source: Internet
Author: User

Use your own mail to send mail under linux

Linux The easiest way to send e-mail

    recently wanted to passLinuxMonitor system status and alarm automatically, GeneralLinuxsend alert messages via local mailbox or external mailbox server, here is the simplest way to implementLinuxusing an external mailbox to send mail, you simply register a domestic mail service mailbox, such as163, you can also use the company mailbox, need to installMAILXtools thatMAILXis a small mail-sending program.

MailThe installation and configuration steps are as follows:1, installation

[email protected] ~]# Yum install Mailx

2, edit the configuration file

[email protected] ~]# vim/etc/mail.rc # Add the following content

Set [email protected]

Set smtp=smtp.126.com

Set [email protected]

Set Smtp-auth-password=xxx

Set Smtp-auth=login

--- Description

from : sender that appears when the other person receives the message

SMTP : Specify a third-party e-mail SMTP Server Address

Set Smtp-auth-user : the user name of the third-party e-mail

Set Smtp-auth-password : password for user name , Some mailboxes are filled with authorization codes

Smtp-auth : SMTP The authentication method, the default is Login , can also be changed to CRAM-MD5 or PLAIN Way

3, Test

[Email protected] ~]# mail-s "HESAUCAQ" [email protected] </etc/passwd

[[email protected] ~]# echo " Test Message " | Mail-s " test " [email protected]

The above has been implemented to send mail Function!!!

in case of:554 dt:spm sent the message content contains not been NetEase license information, or contrary to NetEase's anti-spam service terms, you can send their own mailbox!

Example:

1) No message body

format : mail-s " Theme "   Pickup Address

Example:

mail-s " Test "[Email protected]

    2) with message body

format: mail-s " theme " &NBSP;&NBSP; pickup address <&NBSP; file ( message body .txt)

Example:

mail-s " Message Subject "[Email protected] </data/findyou.txt

format: echo " message body " | Mail-s Mail subject Pickup address

Example:

echo  " message body content "  |  mail -s  " mail subject "   [email protected]

format: Cat message body . txt | mail-s Message Subject Pickup address

Example:

cat/data/findyou.txt | mail-s " Message Subject "[Email protected]

3) with accessories

format:mail-s "Theme"  Pickup Address -AAccessories<file(message body. txt) 

Example:

mail-s " Message Subject "[email protected]-a/data/findyou.tar.gz </data/findyou.txt


Use your own mail to send mail under Linux

Related Article

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.