1
def send_complex_message():
    return requests.post(
         "https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages",
         auth=("api", "YOUR_API_KEY"),
         files=[("attachment", ("test.jpg", open("files/test.jpg","rb").read())),
                ("attachment", ("test.txt", open("files/test.txt","rb").read()))],
         data={"from": "Excited User <YOU@YOUR_DOMAIN_NAME>",
             "to": "foo@example.com",
             "cc": "baz@example.com",
             "bcc": "bar@example.com",
             "subject": "Hello",
             "text": "Testing some Mailgun awesomness!",
             "html": "<html>HTML version of the body</html>"})

这是 mailgun 文档中的代码。我需要访问“html”中“text”的值。有没有办法我可以做到这一点。

4

0 回答 0