Created
September 30, 2016 09:18
-
-
Save fdcore/bf0bee9aa573d4263f2eabe22cd84369 to your computer and use it in GitHub Desktop.
Send mail via Mailgun by requests on Python
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 characters
import requests | |
def mailgun_sendmail(title='no title', content='', recipients=[]): | |
status = requests.post("https://api.mailgun.net/v3/DOMAIN/messages", # DOMAIN - your domain from mailgun | |
auth=("api", "key-2h2f...."), # YOR KEY with key- | |
data={"from": "postmaster@DOMAIN", # YOUR mail from mailgun | |
"to": recipients, | |
"subject": title, | |
"html": content | |
}) | |
return status.status_code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment