Last active
May 12, 2017 18:53
-
-
Save sh4t/24caf59d5cadab7cdff9 to your computer and use it in GitHub Desktop.
Revisions
-
sh4t revised this gist
Nov 7, 2015 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,10 @@ # be sure to replace the FROM field, subject, content, etc # just read the script and follow-along and modify accordingly. # # the contents of the file I am reading are email username: # [email protected] an-user # [email protected] another # [email protected] user3 filename="$1" apikey="api:key-1234abcd5678efghijklmnop" #your mailgun api key -
sh4t created this gist
Nov 7, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ #!/bin/bash # # Changed a few things up from my original version I am using # but thought others might want to have an easy way to send # emails to users using mailgun via bash.. # # be sure to replace the FROM field, subject, content, etc # just read the script and follow-along and modify accordingly. # filename="$1" apikey="api:key-1234abcd5678efghijklmnop" #your mailgun api key domain="shat.io" while read -a line do email=${line[0]} username=${line[1]} curl -s --user "${apikey}" \ https://api.mailgun.net/v3/${domain}/messages \ -F from='shat <[email protected]>' \ -F to="${username} <${email}>" \ -F subject='Put a real subject here homie..' \ -F text='Hello there, Shat here, showing you how to send some emails using mailgun. Feel free to use this example! Kind regards, Shat' > /dev/null echo "queued email to user: ${username} at ${email}" sleep 0.5 # I throttle, just because. done < "$filename"