docs: Tweak email testing notes a bit more.

This commit is contained in:
Tim Abbott
2020-10-30 12:08:36 -07:00
parent ebe92fe70a
commit f2b9109be5

View File

@@ -66,17 +66,17 @@ to an email id of your choice by clicking on **Forward emails to a mail
account** in `/emails` page. This feature can be used for testing how account** in `/emails` page. This feature can be used for testing how
emails gets rendered by different email clients. emails gets rendered by different email clients.
For using this feature you need to have access to the login credentials of For using this feature you need to have access to the login
an SMTP provider. The easiest way to do this would be to use Gmail credentials of an SMTP provider. The easiest way to do this would be
as the SMTP provider. Go through to use Gmail as the SMTP provider. Go through [this
[this doc](../production/email.html#using-gmail-for-outgoing-email) and doc](../production/email.html#using-gmail-for-outgoing-email) and
configure Gmail to allow sending emails using it's SMTP server. You can configure a Gmail account to allow sending emails using SMTP. You can
ignore the warning to avoid using Gmail for sending emails since the doc ignore the warning to avoid using Gmail for sending emails, since the
is written for production environment. anti-spam problems described there aren't relevant for testing use.
There are a bunch of other methods described The services we [recommend for production
[here](../production/email.html#free-outgoing-email-services) as well if you use](../production/email.html#free-outgoing-email-services) are great
don't have a Gmail account or don't want to use it. choices as well.
Once you have the login credentials of the SMTP provider, set the appropriate value Once you have the login credentials of the SMTP provider, set the appropriate value
of the following keys in `zproject/dev-secrets.conf` of the following keys in `zproject/dev-secrets.conf`
@@ -100,21 +100,23 @@ email_password = gmail_password
### Notes ### Notes
* The base_image_uri of the images in forwarded emails would be replaced
with `https://chat.zulip.org/static/images/emails` inorder for the email clients
to render the images. See `zproject/email_backends.py` for more details.
* After changing any HTML email or `email_base.html`, you need to run * After changing any HTML email or `email_base.html`, you need to run
`scripts/setup/inline_email_css.py` for the changes to be reflected in the dev `scripts/setup/inline_email_css.py` for the changes to be reflected
environment. The script generates files like in the development environment. The script generates files like
`templates/zerver/emails/compiled/<template_prefix>.html`. `templates/zerver/emails/compiled/<template_prefix>.html`.
* Images won't be displayed in a real email client unless you change
the `base_image_uri` used for emails to a public URL such as
`https://chat.zulip.org/static/images/emails` (image links to
`localhost:9991` aren't allowed by modern email providers). See
`zproject/email_backends.py` for more details.
* While running the backend test suite, we use * While running the backend test suite, we use
`django.core.mail.backends.locmem.EmailBackend` as the email `django.core.mail.backends.locmem.EmailBackend` as the email
backend. The `locmem` backend stores messages in a special attribute backend. The `locmem` backend stores messages in a special attribute
of the django.core.mail module, "outbox". The outbox attribute is of the django.core.mail module, "outbox". The outbox attribute is
created when the first message is sent. Its a list with an created when the first message is sent. Its a list with an
EmailMessage instance for each message that would be sent. EmailMessage instance for each message that would be sent.
## Email templates ## Email templates