Well in continuing with the themes so far in the 28 Days of Code, I am doing another communication script. Today's script is to send out email using Mailgun's simple API.
A script to send email via the Mailgun API.
requests and API credentials from Mailgun.
You should have requests by now in your python modules as I think it is one of the used modules. If not, here is the install:
pip install requests
Get the app here:
SEND PLAIN EMAIL MESSAGE
python mail_it.py -r email@example.com -s "howdy" -t "Just saying hello."
SEND EMAIL WITH ATTACHMENT
python mail_it.py -r firstname.lastname@example.org -s "Stark Coffee Coupon" -t "Pepper, I appreciate your work, here is a free coffee from Stark Coffee." -a "/home/thetony/Documents/free_coffee.pdf" -f "free_coffe.pdf""
Sending email is incredibly easy with the Mailgun API.