Send mail with built-in mail under Linux
set from= test@163.com ###Set sender's information here set smtp=smtp.163.com ###The mail service address is configured here. Since the mailbox is 163, it is smtp.163.com set smtp-auth-user= test@163.com ###Configure sender's email address here set smtp-auth-password=abc ###Remember that the abc configured here is the client authorization code, not the sender's email address password set smtp-auth=login ###Default authentication method of mail
help(){ echo "eg: $0 [Subject] [address] [content_file] [file]" echo "" exit 1 } if [ ! - n "$1" ] ; then help fi cDate=`date +%Y%m%d` if [ ! - n "$2" ] ; then help else mail_to=$2 echo " Send Mail to ${mail_to}" fi if [ ! - n "$4" ] ; then mail -s $1 ${mail_to}<$3 else mail -s $1 -a $4 ${mail_to}<$3 fi