From 1b66175a60e4ab82ae115eb9d5f7d5b97e68a1ea Mon Sep 17 00:00:00 2001 From: tianyu Date: Tue, 20 Jan 2015 12:32:13 +0800 Subject: [PATCH] Create mail.sh --- opensips/mail.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 opensips/mail.sh diff --git a/opensips/mail.sh b/opensips/mail.sh new file mode 100644 index 0000000..52218ba --- /dev/null +++ b/opensips/mail.sh @@ -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