-
-
Save mcroni/083c521e23785ef87166886ee6c79d2a to your computer and use it in GitHub Desktop.
MailGun API Python Requests multiple Attachments
Send mail with multiple files/attachments with custom file names
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
requests.post("https://api.mailgun.net/v2/DOMAIN/messages", | |
auth=("api", "key-SECRET"), | |
files={ | |
"attachment[0]": ("FileName1.ext", open(FILE_PATH_1, 'rb')), | |
"attachment[1]": ("FileName2.ext", open(FILE_PATH_2, 'rb')) | |
}, | |
data={"from": "FROM_EMAIL", | |
"to": [TO_EMAIL], | |
"subject": SUBJECT, | |
"html": HTML_CONTENT | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment