[GH-ISSUE #1117] ntfy filtering for mail over http #789

Open
opened 2026-05-07 00:27:33 +02:00 by BreizhHardware · 0 comments

Originally created by @lutzky on GitHub (May 24, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1117

💡 Idea

My home server (and workstation) occasionally send emails, e.g. on cron job failures. https://docs.ntfy.sh/examples/#cronjobs shows how to do this manually for cron jobs (and doesn't forward stdout). Another way of doing it is using cron's (or anacron's) built-in MAILTO component, and creating a .forward file with contents such as:

ntfy-my-personal-cron@ntfy.sh
"| curl -H 'Authorization: Bearer tk_tokentokentoken' -H 'X-Tags: email' -d '@-' https://ntfy.mydomain.com/my-personal-cron"

That first line works nicely; e.g. for a sudo password failure, you get a notification that looks like this:

image

However, that second one gets output that looks like this:

image

Now, in my case, mydomain.com runs on CloudFlare, and it's fairly easy to expose HTTP that way, even when opening ports is impossible or undesirable. This doesn't work for email, so I can't send email to my-person-cron@ntfy.mydomain.com.

What would be really nice is if I could supply a header like X-Filter-this-as-though-it-is-email: true for cases like this. Essentially, this should act like smtpSession.Data - extracting the subject, determining if it's HTML, managing attachments, etc.

💻 Target components - ntfy server

Originally created by @lutzky on GitHub (May 24, 2024). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1117 :bulb: **Idea** My home server (and workstation) occasionally send emails, e.g. on cron job failures. https://docs.ntfy.sh/examples/#cronjobs shows how to do this manually for cron jobs (and doesn't forward stdout). Another way of doing it is using cron's (or anacron's) built-in `MAILTO` component, and creating a `.forward` file with contents such as: ``` ntfy-my-personal-cron@ntfy.sh "| curl -H 'Authorization: Bearer tk_tokentokentoken' -H 'X-Tags: email' -d '@-' https://ntfy.mydomain.com/my-personal-cron" ``` That first line works nicely; e.g. for a sudo password failure, you get a notification that looks like this: ![image](https://github.com/binwiederhier/ntfy/assets/8140/1f7ae7ae-f4ea-4bac-95df-ef86558c5b43) However, that second one gets output that looks like this: ![image](https://github.com/binwiederhier/ntfy/assets/8140/b749cb0b-81ce-4b13-88d0-ce04847e7b70) Now, in my case, mydomain.com runs on CloudFlare, and it's fairly easy to expose HTTP that way, even when opening ports is impossible or undesirable. This doesn't work for email, so I can't send email to my-person-cron@ntfy.mydomain.com. What would be really nice is if I could supply a header like `X-Filter-this-as-though-it-is-email: true` for cases like this. Essentially, this should act like [`smtpSession.Data`](https://github.com/binwiederhier/ntfy/blob/9d3fc20e583564e40af5afb90233f4714fdfcb4c/server/smtp_server.go#L131) - extracting the subject, determining if it's HTML, managing attachments, etc. :computer: **Target components** - ntfy server
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#789
No description provided.