Passing Mailgun via HTTP API does not seem to send

I am trying to use Mailgun to send via HTTP API as follows:

Python:

def send_simple_message(string):
    return requests.post(
        "https://api.mailgun.net/v2/samples.mailgun.org/messages",
        auth=("api", "my-key"),
        data={"from": "<me@mydomain.com",
              "to": ["to@recipient.com"],
              "subject": "",
              "text": string})

My domain was verified using CNAME records, and I tried to send a couple of strings tests .

Nothing happened, actually, from my Python script - it didn't appear in the sent items (gmail). So I tried manually through the terminal and received the answer: <Response [404]>.

Address update mydomain.com(thanks @kwatford) I get <Response [200]>(success).

However, it was a test letter that I sent myself (to a different address). I did not receive the message, and it is not in the sent field me@mydomain.com. What did I do wrong?

+4
1

@kwatford , , :

https://api.mailgun.net/v2/samples.mailgun.org/messages :

https://api.mailgun.net/v2/yourdomain.com/messages.

, [200], http://mydomain.com, .

, , , , (, POST!) cp > logs mailgun.com

+6

Source: https://habr.com/ru/post/1527722/


All Articles