Created
March 4, 2015 02:54
-
-
Save webmasterkai/434d7831da507935dfb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
key="" #your maildrill API key | |
from_email="" #who is sending the email | |
reply_to="$from_email" #reply email address | |
from_name="curl sender" #from name | |
if [ $# -eq 3 ]; then | |
msg='{ "async": false, "key": "'$key'", "message": { "from_email": "'$from_email'", "from_name": "'$from_name'", "headers": { "Reply-To": "'$reply_to'" }, "return_path_domain": null, "subject": "'$2'", "text": "'$3'", "to": [ { "email": "'$1'", "type": "to" } ] } }' | |
results=$(curl -A 'Mandrill-Curl/1.0' -d "$msg" 'https://mandrillapp.com/api/1.0/messages/send.json' -s 2>&1); | |
echo "$results" | grep "sent" -q; | |
if [ $? -ne 0 ]; then | |
echo "An error occured: $results"; | |
exit 2; | |
fi | |
else | |
echo "$0 requires 3 arguments - to address, subject, content"; | |
echo "Example: ./$0 \"[email protected]\" \"test\" \"hello this is a test message\"" | |
exit 1; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment