email_process=`echo -e "$BODY" | email -html -timeout 20 -V -s "$HEADER" "$USER_ADDRESS"`
if [[ "$email_process" == *"Sending"*"100% of"* ]]; then
echo " > successfully delivered";
fi
我尝试这个。但是此代码不起作用。因为email_process=Connecting to server smtp.gmail.com on port 587
变量email_process
必须等于
Connecting to server smtp.gmail.com on port 587
Sending "test_text" |********| 100% of 366 Bytes
Sending QUIT...
答案 0 :(得分:0)
wget -q --spider http://google.com
if [ $? -eq 0 ]; then
echo "Online"
else
echo "Offline"
fi
我先尝试过此操作,然后再发送电子邮件。