Comments (5)
Now available with b76b164. π
from mailrise.
So I have a working branch following my initial message I'll push up in the morning for your thoughts on (it's even got tests!) but thinking more about this, maybe it's better to instead extend the existing templating logic with extra variables?
So something like:
configs:
"*@*":
mailrise:
extra_body_variables:
- name: '(?<=<h1>).+(?=<\/h1>)
- type: '(?<=<p>).+(?=<\/p>)'
body_template: '$name, $type'
urls:
- tgram://...
Where then giving it an email body of:
<html><h1>Wardell</h1><p>Super cool programmer</p>
Would then call Apprise like:
apprise --body="Wardell, Super cool programmer"
from mailrise.
Ooh, I appreciate the PR, and the tests. I'm also pleased that you had a chance to work with the code that I had just finished refactoring.
But to be honest, I'm not keen on adding any additional options to the YAML configuration file. I'd like to keep that format simple, so any homelabber can hit the ground running with itβwhat I'd like to do instead is make it possible to supply your own Python class to determine the processing logic. (If you're the type to delve into regexes, you most likely aren't afraid of getting your hands dirty with a little Python, methinks.) In short, you'd be able to write your own SimpleRouter.
I'll have it done soon; I've just been debating the semantics. I'm thinking something like:
mailrise.conf:
python_logic: /path/to/my/logic.py
...
logic.py:
class MyCustomRouter():
async def email_to_apprise(self, logger, email):
...
yield AppriseNotification(...)
router = MyCustomRouter()
I believe such custom routers will provide the most flexibility for users interested in fine-tuning their notifications.
from mailrise.
Hahaha, wow, great minds do think alike!
I love your custom_router
approach here and I'm fully okay with just waiting for that to get in.
That being said, while I think that's a great fit for anyone building from source, it'll be a little weird for anyone using Docker. Mainly because they'll likely have to check out the project anyway to get the right typings and then have their Dockerfile copy over their custom router.
Of course, it's Python and the types don't actually matter but it's going to feel a little odd to write a custom router against one version of Mailrise that might end up running in a different version. That's going to be on the users to keep in sync and I don't think it's overly-difficult, just something to remember as updates happen.
from mailrise.
That being said, while I think that's a great fit for anyone building from source, it'll be a little weird for anyone using Docker. Mainly because they'll likely have to check out the project anyway to get the right typings and then have their Dockerfile copy over their custom router.
Not necessarily. You'll be able to passthrough the .py file just like you can do with the config file itself:
-v /path/to/my/config.yml:/etc/mailrise.conf
-v /path/to/my/pluggable.py:/etc/mailrise_logic.py
That's going to be on the users to keep in sync and I don't think it's overly-difficult, just something to remember as updates happen.
Of course. It's important to design an API that will be unlikely to change.
from mailrise.
Related Issues (20)
- SMTP `AUTH LOGIN` no response after inputting the username and password HOT 2
- SMTP Basic authentication not working? HOT 1
- ntfy attachments don't work HOT 1
- Mail not working
- Apprise Update to 1.7.2
- How can I send something other than text
- Use template in Apprise URL HOT 1
- How to Debug ? HOT 1
- Docker container will not start in Unraid HOT 2
- Docker "hello" repeat log
- Support for Raspberry Pi (linux/arm64/v8) HOT 1
- when attempting to configure proxmox to use mailrise I get a wierd error HOT 4
- Compatibility with FreeBSD HOT 1
- Permission denied: '/etc/mailrise.conf' on TrueNAS HOT 1
- Cannot start mailrise docker container HOT 2
- App issues
- Can't Parse URL with hyphen in domain name. HOT 4
- mailto doesn't work HOT 3
- Slack custom icon
- aiosmtpd rejects unknown parameters in MAIL FROM HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailrise.