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