mirror of
https://github.com/xdtianyu/scripts.git
synced 2025-09-23 12:29:22 +08:00
Create mail.sh
This commit is contained in:
24
opensips/mail.sh
Normal file
24
opensips/mail.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#title :mail.sh [event] [service name] [config file]
|
||||||
|
#description :This script will call mail api to send mail via gmail.
|
||||||
|
#author :xdtianyu@gmail.com
|
||||||
|
#date :20141120
|
||||||
|
#version :1.0 final
|
||||||
|
#usage :bash mail.sh
|
||||||
|
#bash_version :4.3.11(1)-release
|
||||||
|
|
||||||
|
if [ $# -ne 3 ];then
|
||||||
|
echo "Error param.";
|
||||||
|
echo "Usage: $0 [event] [service name] [config file]"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
EVENT=$1
|
||||||
|
NAME=$2
|
||||||
|
CONF=$(cat $3)
|
||||||
|
|
||||||
|
if [ "$(echo $CONF|grep email|wc -l)" == "1" ];then
|
||||||
|
curl -s https://www.xdty.org/mail.php -X POST -d "event=$EVENT&name=$NAME&email=$(echo $CONF|grep email|cut -c7-)"
|
||||||
|
else
|
||||||
|
echo "Config file error."
|
||||||
|
fi
|
Reference in New Issue
Block a user