Skip to content

Instantly share code, notes, and snippets.

@mfrashad
Created September 27, 2021 10:28
Show Gist options
  • Select an option

  • Save mfrashad/ddc1dcb0cb4316e794fb17c1414708f5 to your computer and use it in GitHub Desktop.

Select an option

Save mfrashad/ddc1dcb0cb4316e794fb17c1414708f5 to your computer and use it in GitHub Desktop.
import requests
def email_results_mailgun(email, prompt):
return requests.post("https://api.mailgun.net/v3/text2art.com/messages",
auth=("api", "YOUR_MAILGUN_API_KEY"),
files=[("attachment",("output.png", open("output.png", "rb").read() )),
("attachment", ("output.mp4", open("output.mp4", "rb").read() ))],
data={"from": "Text2Art <YOUR_EMAIL>",
"to": email,
"subject": "Your Artwork is ready!",
"text": f'Your generated arts using the prompt "{prompt}".',
"html": f'Your generated arts using the prompt <strong>"{prompt}"</strong>.'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment