diff --git a/static/templates/subscription.handlebars b/static/templates/subscription.handlebars index 50a0122750..6c50ff4465 100644 --- a/static/templates/subscription.handlebars +++ b/static/templates/subscription.handlebars @@ -48,12 +48,12 @@ - {{#if subscribed}} + {{#if_and subscribed email_address}}

Email address

- {{/if}} + {{/if_and}} {{#if allow_rename}}
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index fd39d3366a..0dcfa7033d 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -1518,6 +1518,10 @@ def encode_email_address(stream): return encode_email_address_helper(stream.name, stream.email_token) def encode_email_address_helper(name, email_token): + # Some deployments may not use the email gateway + if settings.EMAIL_GATEWAY_PATTERN == '': + return '' + # Given the fact that we have almost no restrictions on stream names and # that what characters are allowed in e-mail addresses is complicated and # dependent on context in the address, we opt for a very simple scheme: diff --git a/zproject/local_settings_template.py b/zproject/local_settings_template.py index 4d04f83a76..911a4c1026 100644 --- a/zproject/local_settings_template.py +++ b/zproject/local_settings_template.py @@ -39,6 +39,29 @@ TWITTER_CONSUMER_SECRET = '' TWITTER_ACCESS_TOKEN_KEY = '' TWITTER_ACCESS_TOKEN_SECRET = '' +# The email gateway provides an email address that you can use to post to a stream +# Emails received at the per-stream email address will be converted into a Zulip +# message + +# The email address pattern to use for auto-generated stream emails +# The %s will be replaced with a unique token, and the resulting email +# must be delivered to the EMAIL_GATEWAY_IMAP_FOLDER of the EMAIL_GATEWAY_LOGIN account below +EMAIL_GATEWAY_PATTERN = "" + +# The Zulip username of the bot that the email pattern should post as +EMAIL_GATEWAY_BOT = "" + +# Configuration of the email mirror mailbox +# The IMAP login and password +EMAIL_GATEWAY_LOGIN = "" +EMAIL_GATEWAY_PASSWORD = "" +# The IMAP server & port to connect to +EMAIL_GATEWAY_IMAP_SERVER = "" +EMAIL_GATEWAY_IMAP_PORT = 993 +# The IMAP folder name to check for emails. All emails sent to EMAIL_GATEWAY_PATTERN above +# must be delivered to this folder +EMAIL_GATEWAY_IMAP_FOLDER = "INBOX" + # When using SSO: If REMOTE_USER only provides a username, append this domain # to the returned value. SSO_APPEND_DOMAIN = None diff --git a/zproject/settings.py b/zproject/settings.py index 301c564bd6..cc87c7ae48 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -232,6 +232,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '', 'TWITTER_ACCESS_TOKEN_KEY': '', 'TWITTER_ACCESS_TOKEN_SECRET': '', 'EMBEDLY_KEY': '', + 'EMAIL_GATEWAY_PATTERN': '', 'EMAIL_GATEWAY_BOT': None, 'EMAIL_GATEWAY_LOGIN': None, 'EMAIL_GATEWAY_PASSWORD': None,