# # Import smtplib for the actual sending function # import smtplib # # Import the email modules we'll need # from email.mime.text import MIMEText # # Open a plain text file for reading. For this example, assume that # # the text file contains only ASCII characters. # # with open(textfile, 'rb') as fp: # # # Create a text/plain message # # msg = MIMEText(fp.read()) # msg = MIMEText("hello there", "plain", "utf-8") # # me == the sender's email address # # you == the recipient's email address # me = "waylon@waylonwalker.com" # you = "3195728809@msg.fi.google.com" # msg["Subject"] = "Python SMTP test" # msg["From"] = me # msg["To"] = you # # Send the message via our own SMTP server, but don't include the # # envelope header. # s = smtplib.SMTP("localhost") # s.sendmail(me, [you], msg.as_string()) # s.quit() import requests requests.post( "https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages", auth=("api", "YOUR_API_KEY"), data={ "from": "Excited User ", "to": ["bar@example.com", "YOU@YOUR_DOMAIN_NAME"], "subject": "Hello", "text": "Testing some Mailgun awesomness!", }, )