Sending Mailgun Inline Images in HTML using Python Requests library

后端 未结 2 1128
日久生厌
日久生厌 2020-12-17 00:39

I am having trouble working out how I can send multiple inline messages using the Mailgun api, from a Python app using the requests library. Currently I have (using jinja2 f

2条回答
  •  误落风尘
    2020-12-17 01:28

    Sending Inline Images is documented here.

    In the HTML, you'll reference the image like this:

    Inline image here: 
    

    Then, define a Multidict, to post the files to the API:

    files=MultiDict([("inline", open("files/test.jpg"))])
    

    Disclosure, I work for Mailgun. :)

提交回复
热议问题