the mail gateway works correctly, the issue is on your side. But you do not need to use the mail gateway.
Use a http request directly in python, its much faster.
Here an example code included image from local or remote (URL):
Code: Select all
from urllib.parse import urlencode
from urllib.request import Request, urlopen
import base64
# local image from drive
file = 'logo.jpg'
image = open(file, 'rb')
image_read = image.read()
image1 = base64.encodebytes(image_read)
# remote image from url
image2 = base64.b64encode(urlopen("https://www.pushsafer.com/de/assets/img/chrome_webpush.jpg").read())
url = 'https://www.pushsafer.com/api' # Set destination URL here
post_fields = { # Set POST fields here
"t" : 'Test',
"m" : 'Test Message',
"s" : 11,
"v" : 3,
"i" : 33,
"c" : '#FF0000',
"d" : 'a',
"u" : 'https://www.pushsafer.com',
"ut" : 'Open Pushsafer',
"k" : '[private_key]',
"p" : 'data:image/jpeg;base64,'+str(image1.decode('ascii')),
"p2" : 'data:image/jpeg;base64,'+str(image2.decode('ascii')),
}
request = Request(url, urlencode(post_fields).encode())
json = urlopen(request).read().decode()
print(json)