mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
email_mirror: Rewrite docstrings to focus on current reality.
These docstrings hadn't been properly updated in years, and bad an awkward mix of a bad version of the user-facing documentation and details that are no longer true (e.g. references to "Voyager"). (One important detail is that we have real documentation for this system now).
This commit is contained in:
@@ -1,31 +1,33 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
"""
|
"""Postfix implementation of the incoming email gateway's helper for
|
||||||
Forward messages sent to the configured email gateway to Zulip.
|
forwarding emails into Zulip.
|
||||||
|
|
||||||
For zulip.com, messages to that address go to the Inbox of emailgateway@zulip.com.
|
https://zulip.readthedocs.io/en/latest/production/settings.html#email-gateway
|
||||||
Zulip voyager configurations will differ.
|
|
||||||
|
|
||||||
Messages meant for Zulip have a special recipient form of
|
The email gateway supports two major modes of operation: An email
|
||||||
|
server (using postfix) where the email address configured in
|
||||||
|
EMAIL_GATEWAY_PATTERN delivers emails directly to Zulip (this) or a
|
||||||
|
cron job that connects to an IMAP inbox (which receives the emails)
|
||||||
|
periodically.
|
||||||
|
|
||||||
<stream name>+<regenerable stream token>@streams.zulip.com
|
Zulip's puppet configuration takes care of configuring postfix to
|
||||||
|
execute this script when emails are received by postfix, piping the
|
||||||
This pattern is configurable via the EMAIL_GATEWAY_PATTERN settings.py
|
email content via standard input (and the destination email address in
|
||||||
variable.
|
the ORIGINAL_RECIPIENT environment variable).
|
||||||
|
|
||||||
Configure your MTA to execute this script on message
|
|
||||||
receipt with the contents of the message piped to standard input. The
|
|
||||||
script will queue the message for processing. In this mode of invocation,
|
|
||||||
you should pass the destination email address in the ORIGINAL_RECIPIENT
|
|
||||||
environment variable.
|
|
||||||
|
|
||||||
In Postfix, you can express that via an /etc/aliases entry like this:
|
In Postfix, you can express that via an /etc/aliases entry like this:
|
||||||
|/home/zulip/deployments/current/scripts/lib/email-mirror-postfix -r ${original_recipient}
|
|/home/zulip/deployments/current/scripts/lib/email-mirror-postfix -r ${original_recipient}
|
||||||
|
|
||||||
|
To manage DoS issues, this script does very little work (just sending
|
||||||
|
an HTTP request to queue the message for processing) to avoid
|
||||||
|
importing expensive libraries.
|
||||||
|
|
||||||
Also you can use optional keys to configure the script and change default values:
|
Also you can use optional keys to configure the script and change default values:
|
||||||
|
|
||||||
-s SHARED_SECRET For adding shared secret key if it is not contained in
|
-s SHARED_SECRET For adding shared secret key if it is not contained in
|
||||||
"/etc/zulip/zulip-secrets.conf".
|
"/etc/zulip/zulip-secrets.conf". This key is used to authenticate
|
||||||
|
the HTTP requests made by this tool.
|
||||||
|
|
||||||
-d HOST Destination Zulip host for email uploading. Address must contain type of
|
-d HOST Destination Zulip host for email uploading. Address must contain type of
|
||||||
HTTP protocol, i.e "https://example.com". Default value: "https://127.0.0.1".
|
HTTP protocol, i.e "https://example.com". Default value: "https://127.0.0.1".
|
||||||
@@ -36,6 +38,7 @@ Also you can use optional keys to configure the script and change default values
|
|||||||
self-signed certificates. Default value: False.
|
self-signed certificates. Default value: False.
|
||||||
|
|
||||||
-t Disable sending request to the Zulip server. Default value: False.
|
-t Disable sending request to the Zulip server. Default value: False.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
"""
|
"""Cron job implementation of Zulip's incoming email gateway's helper
|
||||||
Forward messages sent to the configured email gateway to Zulip.
|
for forwarding emails into Zulip.
|
||||||
|
|
||||||
For zulip.com, messages to that address go to the Inbox of emailgateway@zulip.com.
|
https://zulip.readthedocs.io/en/latest/production/settings.html#email-gateway
|
||||||
Zulip voyager configurations will differ.
|
|
||||||
|
|
||||||
Messages meant for Zulip have a special recipient form of
|
The email gateway supports two major modes of operation: An email
|
||||||
|
server (using postfix) where the email address configured in
|
||||||
|
EMAIL_GATEWAY_PATTERN delivers emails directly to Zulip, and this, a
|
||||||
|
cron job that connects to an IMAP inbox (which receives the emails)
|
||||||
|
periodically.
|
||||||
|
|
||||||
<stream name>+<regenerable stream token>@streams.zulip.com
|
Run this in a cronjob every N minutes if you have configured Zulip to
|
||||||
|
poll an external IMAP mailbox for messages. The script will then
|
||||||
This pattern is configurable via the EMAIL_GATEWAY_PATTERN settings.py
|
connect to your IMAP server and batch-process all messages.
|
||||||
variable.
|
|
||||||
|
|
||||||
Run this in a cronjob every N minutes if you have configured Zulip to poll
|
|
||||||
an external IMAP mailbox for messages. The script will then connect to
|
|
||||||
your IMAP server and batch-process all messages.
|
|
||||||
|
|
||||||
We extract and validate the target stream from information in the
|
We extract and validate the target stream from information in the
|
||||||
recipient address and retrieve, forward, and archive the message.
|
recipient address and retrieve, forward, and archive the message.
|
||||||
|
|||||||
Reference in New Issue
Block a user