Page 2 of 2

Re: Alerts no longer working from 1 source

Posted: 24. Sep 2021, 08:37
by admin
Hi,

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)

Re: Alerts no longer working from 1 source

Posted: 27. Sep 2021, 09:38
by alex@team-meek.com
thanks - that code works just fine.

Bit of a mystery why the email stopped working but its working ok with the new code so happy days

thanks for your help

Re: Alerts no longer working from 1 source

Posted: 28. Sep 2021, 10:23
by admin
alex@team-meek.com wrote:
27. Sep 2021, 09:38
thanks - that code works just fine.

Bit of a mystery why the email stopped working but its working ok with the new code so happy days

thanks for your help
:D great!!!

But the mail issue is on your side!

Kevin