Send mail from your serving using mailjet

Mailjet is worth giving a try. www.mailjet.com/ Super easy to get started. They have a free tier for trying it out with no credit card and no expiration.
For automation, you can send email with an API connection or SMTP.
After you create your account, they take to a page to test your mail. For example, a curl script with all the fields filled out with your email addy and API key etc. Just copy/paste it to a server and Jerry is your Uncle.

One thought on “Send mail from your serving using mailjet”

  1. Here is a mailjet script I use

    #!/bin/sh
    # search web logs for a string, if found send email with mailjet
    # then rename logfile so it won’t alert again and reload http.
    SUBJ=”MYSERVICE LOG ALERT”
    MESS=”LOG CHECK”

    MATCHC=$(grep bigbadvoodoodaddy /var/log/httpd/access_log | wc -l)

    if [[ $MATCHC -gt 0 ]];then
    MESS=”MATCH FOUND, COUNT ${MATCHC}”

    echo sending $SUBJ $MESS
    curl -s \
    -X POST \
    –user “userinfomailjet:moreinfomailjet” \
    https://api.mailjet.com/v3.1/send \
    -H ‘Content-Type: application/json’ \
    -d ‘{
    “Messages”:[
    {
    “From”: {
    “Email”: “auto@example.com”,
    “Name”: “Auto”
    },
    “To”: [
    {
    “Email”: “alert@example.com”,
    “Name”: “Alert”
    }
    ],
    “Subject”: “‘”${SUBJ}”‘”,
    “TextPart”: “‘”${MESS}”‘”,
    “CustomID”: “AppGettingStartedTest”
    }
    ]
    }’
    #rotate logs

    now=”_$(date +%y_%m_%d_%H_%M)”
    mv /var/log/httpd/access_log /var/log/httpd/access_log${now}
    /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
    fi
    echo completed

Comments are closed.