caronc / apprise-api

A lightweight REST framework that wraps the Apprise Notification Library
https://hub.docker.com/r/caronc/apprise
MIT License
580 stars 50 forks source link

Custom Email Service: Incorrect url creation with curl /add/{KEY} from v0.8.0 on wards #102

Closed fspc closed 10 months ago

fspc commented 1 year ago

This bug took me a while to hunt down, hopefully, I am just doing something incorrect. I am able to add the proper formatted custom email service url to the api with v0.7.3:

curl -X POST -d '{"urls":"mailtos://fake.mail.org:465/Test%3Afakeperson@email.com?user=fake%40email.com&pass=pass&mode=ssl&from=fake%40email.com"}' \ 
-H "Content-Type: application/json" http://localhost:8000/add/test

curl -X POST  http://localhost:8000/get/test
mailtos://fake:pass@fake.mail.org:465/Test%3Afakeperson%40email.com?from=fake%40email.com&mode=ssl&smtp=fake.mail.org&user=fake%40email.com&format=html&overflow=upstream&rto=4.0&cto=15&verify=yes

However, please note these two issues:

  1. /notify/{KEY} does not work for v0.7.3 with this url, but it does work for all later versions beginning with v0.8.0. (probably a moot issue now since the newer versions are out)
  2. The url isn't properly created for later versions beginning with v0.8.0. Here is what is happening with the latest version (v0.8.3):
curl -X POST -d '{"urls":"mailtos://fake.mail.org:465/Test%3Afakeperson@email.com?user=fake%40email.com&pass=pass&mode=ssl&from=fake%40email.com"}' \
-H "Content-Type: application/json" http://localhost:8000/add/test

curl -X POST  http://localhost:8000/get/test
mailtos://fake:pass@fake.mail.org/Test%3Afakeperson%40email.com?format=html&overflow=upstream&rto=4.0&cto=15&verify=yes&mode=ssl&from=fake%40email.com

In this version, port, smtp and user are missing.

caronc commented 1 year ago

This may not be a bug per-say. the smtp only appears if the smtp server is different from the host. This way the generated Apprise URL is smaller.

As per the port, it works the same way. It is only set if it's value differs from the mode. if you set the mode to ssl, then port 465 is already assumed. If you were to set the port to something different, only then would it be part of the URL.

There is another reason why your URL isn't working. You're saying the URL above works using Apprise v0.7.3?

fspc commented 1 year ago

In this case, smtp is on a different host so in cases where it (and user) is not generated (> v0.7.3), curl calls fail to work.

There is another reason why your URL isn't working. You're saying the URL above works using Apprise v0.7.3?

No, the proper url that is generated by v0.7.3, doesn't work with v0.7.3, but it does work with later versions. But later versions are not generating a url that work properly. The steps required to get the custom email service working properly is

  1. generate the proper url with curl with v0.7.3 running,
  2. and then query the proper url with curl, with a later version of Apprise running, in order to send out an email.
fspc commented 1 year ago

There is another reason why your URL isn't working. You're saying the URL above works using Apprise v0.7.3?

  1. and then query the proper url with curl, with a later version of Apprise running, in order to send out an email.

Actually, for some reason v0.7.3 is working on a different KVM when sending out an email. Weird, not sure why. But v0.7.3 is required to create the proper formed url for later versions, in order to send out an email to a custom email service.

There shouldn't be any differences, between those two containers on their respective machines.

caronc commented 1 year ago

Is this still occurring?

fspc commented 1 year ago

I'll run a test with the newest version to verify if that is the case.

caronc commented 11 months ago

No matter how i do this, the email appears to be working fine. Make sure you use the latest build during your testing.

caronc commented 10 months ago

Closing this issue off due to lack of response. Feel free to open this if it's still occurring