#!/bin/bash -x . ./config.sh FILE=$1; shift; oldIFS="$IFS" IFS=":" MAILDATA=($(awk -F ': ' '{if ($1=="To") {to=$2} if ($1=="From") {from=$2} if ($1=="Subject") {subject=$2} lastline=$1 } END {print from":"to":"subject":"lastline}' < "$FILE")) rm -f "$FILE" IFS="$oldIFS" echo "${MAILDATA[2]}" SUBSCRIBER="${MAILDATA[0]}" SIGNATURE="${MAILDATA[3]}" SIGNATURECHECKVALUE="$(echo -n "$SUBSCRIBER$SITE_SECRET" | sha512sum | awk '{print $1}')" if [ "$SIGNATURE" != "$SIGNATURECHECKVALUE" ]; then exit -1 fi echo "$SUBSCRIBER" | add_members -r - news exit 0