简体   繁体   中英

Python Mailgun API Not Sending Email

When running the program the email does not appear in my mailbox, I do not get any errors.

import requests
def send_simple_message():
    return requests.post(
        "https://api.mailgun.net/v3/sandbox26ec5a4187a942f6a834bb53d77d2b31.mailgun.org/messages",
        auth=("api", "API_KEY"),
        data={"from": "Excited User <mailgun@sandbox26ec5a4187a942f6a834bb53d77d2b31.mailgun.org>",
            "to": ["MY_EMAIL", "MY_SECOND_EMAIL"],
            "subject": "Hello",
            "text": "Testing some Mailgun awesomness!"})

If this is all your code, you might miss send_simple_message() after the definition. It seems you built definition without calling it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM