Browse Source

fix format

notify
neilpang 4 years ago
parent
commit
45a8bdbedc
  1. 3
      notify/mailgun.sh
  2. 5
      notify/sendgrid.sh

3
notify/mailgun.sh

@ -16,6 +16,7 @@ mailgun_send() {
_subject="$1"
_content="$2"
_statusCode="$3" #0: success, 1: error 2($RENEW_SKIP): skipped
_debug "_statusCode" "$_statusCode"
MAILGUN_API_KEY="${MAILGUN_API_KEY:-$(_readaccountconf_mutable MAILGUN_API_KEY)}"
if [ -z "$MAILGUN_API_KEY" ]; then
@ -112,7 +113,7 @@ _mailgun_rest() {
response="$(_post "$_mgdata" "$_mgurl" "" "$_method")"
fi
if [ "$?" != "0" ]; then
_err "Error: $ep"
_err "Error: $_mguri"
_err "$response"
return 1
fi

5
notify/sendgrid.sh

@ -10,6 +10,7 @@ sendgrid_send() {
_subject="$1"
_content="$2"
_statusCode="$3" #0: success, 1: error 2($RENEW_SKIP): skipped
_debug "_statusCode" "$_statusCode"
SENDGRID_API_KEY="${SENDGRID_API_KEY:-$(_readaccountconf_mutable SENDGRID_API_KEY)}"
if [ -z "$SENDGRID_API_KEY" ]; then
@ -41,7 +42,7 @@ sendgrid_send() {
_content="$(echo "$_content" | _json_encode)"
_data="{\"personalizations\": [{\"to\": [{\"email\": \"$SENDGRID_TO\"}]}],\"from\": {\"email\": \"$SENDGRID_FROM\"},\"subject\": \"$_subject\",\"content\": [{\"type\": \"text/plain\", \"value\": \"$_content\"}]}"
response="" #just make shellcheck happy
if _post "$_data" "https://api.sendgrid.com/v3/mail/send"; then
if [ -z "$response" ]; then
_info "sendgrid send sccess."
@ -50,6 +51,6 @@ sendgrid_send() {
fi
_err "sendgrid send error."
_err "$response"
return 1;
return 1
}

Loading…
Cancel
Save