I use mailgun to send mail. I try to use python api
pwd = "path-to-image/logo.png"
return requests.post(
"https://api.mailgun.net/v2/sandboxsomething.mailgun.org/messages",
auth=("api", "key-something"),
files=[("inline", open(pwd)),],
data={"from": src,
"to": des,
"subject": sub,
"html": message})
but It can't send image.
after that I try to show just png file when I print print open(pwd).read()
I get:
�PNG
none
but when I try to print open('path-to-image/a.txt')
,I get content the file:
all content of a.text
none
why the png
file not read?
open for image must be:
open(pwd,"rb")
for read it in binary mode.