#!/bin/bash
Smail () {
smtp= "mail.mailadd.com 25" # Mail server address +25 port
smtp_domain= "mailadd.com" # Send the domain name of the mail,
from= "xxx@mailadd.com" after @ @ Send mail address
rcptto=$1 # recipient address
username_base64= "Xxxxxxxxxxxxxxxxx" # User name base64 encoding
password_base64= "xxxxxxxx" # Password base64 encoding
local_ip= ' ifconfig|grep bcast|awk-f: ' {print $} ' |awk-f "" ' {print} ' |head-1 '
local_name= ' uname-n '
(for I in "Ehlo $smtp _domain" "AUTH LOGIN" "$username _base64" "$p Assword_base64 "" MAIL from:< $FROM > "" RCPT to:< $RCPTTO > "DATA";d o
echo $i sleep
4 done
echo "subject:server alert"
echo "from:< $FROM >"
echo "to:< $RCPTTO >"
echo
" echo "Server $local _name up, IP: $local _ip"
echo. "
Sleep 2
echo "quit") |telnet $smtp
}
smail xxx@163.com # Here The parameter is the receipt address