-
-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Philipp Heckel
committed
Dec 28, 2021
1 parent
a46a520
commit dac8839
Showing
7 changed files
with
90 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,21 +36,65 @@ Subscribers can retrieve cached messaging using the [`poll=1` parameter](subscri | |
[`since=` parameter](subscribe/api.md#fetch-cached-messages). | ||
|
||
## E-mail notifications | ||
To allow forwarding messages via e-mail, you can configure an SMTP server for outgoing messages. Once configured, | ||
To allow forwarding messages via e-mail, you can configure an **SMTP server for outgoing messages**. Once configured, | ||
you can set the `X-Email` header to [send messages via e-mail](publish.md#e-mail-notifications) (e.g. | ||
`curl -d "hi there" -H "X-Email: [email protected]" ntfy.sh/mytopic`). | ||
|
||
As of today, only SMTP servers with PLAIN auth and STARTLS are supported. To enable e-mail sending, you must set the | ||
following settings: | ||
|
||
* `base-url` is the root URL for the ntfy server; this is needed for e-mail footer | ||
* `smtp-addr` is the hostname:port of the SMTP server | ||
* `smtp-user` and `smtp-pass` are the username and password of the SMTP user | ||
* `smtp-from` is the e-mail address of the sender | ||
* `smtp-sender-addr` is the hostname:port of the SMTP server | ||
* `smtp-sender-user` and `smtp-sender-pass` are the username and password of the SMTP user | ||
* `smtp-sender-from` is the e-mail address of the sender | ||
|
||
Here's an example config using [Amazon SES](https://aws.amazon.com/ses/) for outgoing mail (this is how it is | ||
configured for `ntfy.sh`): | ||
|
||
=== "/etc/ntfy/server.yml" | ||
``` yaml | ||
base-url: "https://ntfy.sh" | ||
smtp-sender-addr: "email-smtp.us-east-2.amazonaws.com:587" | ||
smtp-sender-user: "AKIDEADBEEFAFFE12345" | ||
smtp-sender-pass: "Abd13Kf+sfAk2DzifjafldkThisIsNotARealKeyOMG." | ||
smtp-sender-from: "[email protected]" | ||
``` | ||
|
||
Please also refer to the [rate limiting](#rate-limiting) settings below, specifically `visitor-email-limit-burst` | ||
and `visitor-email-limit-burst`. Setting these conservatively is necessary to avoid abuse. | ||
|
||
## E-mail publishing | ||
To allow publishing messages via e-mail, ntfy can run a lightweight **SMTP server for incoming messages**. Once configured, | ||
users can [send emails to a topic e-mail address](publish.md#e-mail-publishing) (e.g. `[email protected]` or | ||
`[email protected]`) to publish messages to a topic. This is useful for e-mail based integrations such as for | ||
statuspage.io (though these days most services also support webhooks and HTTP calls). | ||
|
||
To configure the SMTP server, you must at least set `smtp-server-listen` and `smtp-server-domain`: | ||
|
||
* `smtp-server-listen` defines the IP address and port the SMTP server will listen on, e.g. `:25` or `1.2.3.4:25` | ||
* `smtp-server-domain` is the e-mail domain, e.g. `ntfy.sh` | ||
* `smtp-server-addr-prefix` is an optional prefix for the e-mail addresses to prevent spam. If set to `ntfy-`, for instance, | ||
only e-mails to `[email protected]` will be accepted. If this is not set, all emails to `[email protected]` will be | ||
accepted (which may obviously be a spam problem). | ||
|
||
Here's an example config (this is how it is configured for `ntfy.sh`): | ||
|
||
=== "/etc/ntfy/server.yml" | ||
``` yaml | ||
smtp-server-listen: ":25" | ||
smtp-server-domain: "ntfy.sh" | ||
smtp-server-addr-prefix: "ntfy-" | ||
``` | ||
|
||
In addition to configuring the ntfy server, you have to create two DNS records (an [MX record](https://en.wikipedia.org/wiki/MX_record) | ||
and a corresponding A record), so incoming mail will find its way to your server. Here's an example of how `ntfy.sh` is | ||
configured (in [Amazon Route 53](https://aws.amazon.com/route53/)): | ||
|
||
<figure markdown> | ||
![DNS records for incoming mail](static/img/screenshot-email-publishing-dns.png){ width=600 } | ||
<figcaption>DNS records for incoming mail</figcaption> | ||
</figure> | ||
|
||
## Behind a proxy (TLS, etc.) | ||
!!! warning | ||
If you are running ntfy behind a proxy, you must set the `behind-proxy` flag. Otherwise, all visitors are | ||
|
@@ -66,7 +110,7 @@ as opposed to the remote IP address. If the `behind-proxy` flag is not set, all | |
be counted as one, because from the perspective of the ntfy server, they all share the proxy's IP address. | ||
|
||
=== "/etc/ntfy/server.yml" | ||
``` | ||
``` yaml | ||
# Tell ntfy to use "X-Forwarded-For" to identify visitors | ||
behind-proxy: true | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -691,6 +691,28 @@ Here's what that looks like in Google Mail: | |
<figcaption>E-mail notification</figcaption> | ||
</figure> | ||
|
||
## E-mail publishing | ||
You can publish messages to a topic via e-mail, i.e. by sending an email to a specific address. For instance, you can | ||
publish a message to the topic `sometopic` by sending an e-mail to `[email protected]`. This is useful for e-mail | ||
based integrations such as for statuspage.io (though these days most services also support webhooks and HTTP calls). | ||
|
||
Depending on the [server configuration](config.md#e-mail-publishing), the e-mail address format can have a prefix to | ||
prevent spam on topics. For ntfy.sh, the prefix is configured to `ntfy-`, meaning that the general e-mail address | ||
format is: | ||
|
||
``` | ||
[email protected] | ||
``` | ||
|
||
As of today, e-mail publishing only supports adding a [message title](#message-title) (the e-mail subject). Tags, priority, | ||
delay and other features are not supported (yet). Here's an example that will publish a message with the | ||
title `You've Got Mail` to topic `sometopic` (see [ntfy.sh/sometopic](https://ntfy.sh/sometopic)): | ||
|
||
<figure markdown> | ||
![e-mail publishing](static/img/screenshot-email-publishing-gmail.png){ width=500 } | ||
<figcaption>Publishing a message via e-mail</figcaption> | ||
</figure> | ||
|
||
## Advanced features | ||
|
||
### Message caching | ||
|
@@ -846,7 +868,7 @@ but just in case, let's list them all: | |
|---|---| | ||
| **Message length** | Each message can be up to 512 bytes long. Longer messages are truncated. | | ||
| **Requests** | By default, the server is configured to allow 60 requests at once, and then refills the your allowed requests bucket at a rate of one request per 10 seconds. You can read more about this in the [rate limiting](config.md#rate-limiting) section. | | ||
| **E-mails** | By default, the server is configured to allow 16 e-mails at once, and then refills the your allowed e-mail bucket at a rate of one per hour. You can read more about this in the [rate limiting](config.md#rate-limiting) section. | | ||
| **E-mails** | By default, the server is configured to allow sending 16 e-mails at once, and then refills the your allowed e-mail bucket at a rate of one per hour. You can read more about this in the [rate limiting](config.md#rate-limiting) section. | | ||
| **Subscription limits** | By default, the server allows each visitor to keep 30 connections to the server open. | | ||
| **Total number of topics** | By default, the server is configured to allow 5,000 topics. The ntfy.sh server has higher limits though. | | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,15 @@ | |
# smtp-sender-pass: | ||
# smtp-sender-from: | ||
|
||
# XXXXXXXXXXXXXXXXXXXXxx | ||
# If enabled, ntfy will launch a lightweight SMTP server for incoming messages. Once configured, users can send | ||
# emails to a topic e-mail address to publish messages to a topic. | ||
# | ||
# - smtp-server-listen defines the IP address and port the SMTP server will listen on, e.g. :25 or 1.2.3.4:25 | ||
# - smtp-server-domain is the e-mail domain, e.g. ntfy.sh | ||
# - smtp-server-addr-prefix is an optional prefix for the e-mail addresses to prevent spam. If set to "ntfy-", | ||
# for instance, only e-mails to [email protected] will be accepted. If this is not set, all emails to | ||
# [email protected] will be accepted (which may obviously be a spam problem). | ||
# | ||
# smtp-server-listen: | ||
# smtp-server-domain: | ||
# smtp-server-addr-prefix: | ||
|