caronc / apprise

Apprise - Push Notifications that work with just about every platform!
https://hub.docker.com/r/caronc/apprise
BSD 2-Clause "Simplified" License
10.91k stars 384 forks source link

Using Notify_email variables `user` and `pass` in yaml doesn't work #1087

Closed alteriks closed 3 months ago

alteriks commented 3 months ago

:mega: Notification Service(s) Impacted Notify_email

:lady_beetle: Describe the bug Using Notify_email variables user and pass in yaml doesn't work. Both variables are ignored in yaml, they only work in mailtos url. This should work and make config more readable:

version: 1
urls:
  - mailtos://alt.lan/:
    - user: testuser@alt.lan
      pass: xxxxXXXxxx
      smtp: smtp.alt.lan
      to: alteriks@alt.lan

But unfortunately it doesn't :/ image


I've created test environment in my homelab with following:


✅User and pass specified in mailtos url:

version: 1
urls:
  - mailtos://alt.lan/?user=testuser@alt.lan&pass=xxxxXXXxxx:
    - smtp: smtp.alt.lan
      to: alteriks@alt.lan

image This example works as expected


❗Overiding nonexistinguser with testuser doesn't work:

version: 1
urls:
  - mailtos://alt.lan/?user=nonexistinguser@alt.lan&pass=nonexistingpass:
    - user: testuser@alt.lan
      pass: xxxxXXXxxx
      smtp: smtp.alt.lan
      to: alteriks@alt.lan

image Yaml user: testuser@alt.lan should override mailtos nonexistinguser@alt.lan, mail should be send


❗Overiding testuser with nonexistinguser doesn't work:

version: 1
urls:
  - mailtos://alt.lan/?user=testuser@alt.lan&pass=xxxxXXXxxx:
    - user: nonexistinguser@alt.lan
      pass: xxxxXXXxxx
      smtp: smtp.alt.lan
      to: alteriks@alt.lan

image Yaml user: nonexistinguser@alt.lan should override mailtos testuser@alt.lan, mail shouldn't be send


❗Not specifying user and pass in mailtos url doesn't work:

version: 1
urls:
  - mailtos://alt.lan/:
    - user: testuser@alt.lan
      pass: xxxxXXXxxx
      smtp: smtp.alt.lan
      to: alteriks@alt.lan

image


❗Overriding good pass xxxxXXXxxx with nonexistingpass sends email, but it shouldn't

version: 1
urls:
  - mailtos://alt.lan/?user=testuser@alt.lan&pass=xxxxXXXxxx:
    - user: testuser@alt.lan
      pass: nonexistingpass
      smtp: smtp.alt.lan
      to: alteriks@alt.lan

image

:computer: Your System Details:

caronc commented 3 months ago

This is a great find on your part. Thank you for sharing this.

I will keep with the regular Apprise Laws (if we call them that) and always ensure that ?arg=param over-ride all to eliminate ambiguity. But the built in Apprise variables such as pass= and others were definitely not being correctly parsed from the URL (found in YAML files) and arguments (if specified in-line thereafter).

I fixed this in the attached PR and added test cases thanks to the great examples you provided.

Code has been merged into master; so it will definitely make it to the next release.

Thank you so much for reporting this. :rocket: :pray:

Chris