YoRyan/mailrise

Allow use of variables in urls

Efocat opened this issue · 2 comments

It would be nice to expand the use of template string variables in urls for a catch all config

for example:

configs:
  # gmail pass-through
  "*@gmail.com":
    urls:
      - mailtos://user:password@gmail.com?from=${from}&to=${to}
    mailrise:
      title_template: "${subject}"

essentially this enables mailrise the ability to easily pass-through email to an external smtp server with a catch all

my use case is for Ombi where the system may send notification to multiple users using mailrise but some user only has email configured and it would be tedious to have individual entry for each of those user.

Version 1.3.0

This isn't trivial because Apprise isn't aware of the template string variables. We could expand them when passing the YAML configuration (which is just a string) to Apprise, but that could create weird conflicts if Apprise ever adds future URL formats that look like template strings.

Another problem is that Mailrise currently instantiates one Apprise configuration per notification target, on startup. If you're going to make the configuration depend on variables, you have to instantiate a new one each time you process a message.

You guys are coming up with some surprisingly complex configurations. I think the most general way to solve edge cases like this would be to make it possible to supply Python code to Mailrise to determine the processing logic. People who don't program can stick with the template strings and wildcards.

YoRyan commented

Not keen on implementing this due to the aforementioned issues. But with b76b164, you can now build your own custom router to overcome the limitations of the template system.