zulip/zerver
Cyril Pletinckx b7fa41601d emails: Truncate overly-long From fields for RFC compatibility.
Amazon SES has a limit on the size of address fields, and rejects
emails with too-long "From" combinations of name and address. This
limit is set to 320 bytes and comes from an RFC limitation on the
size of addresses. This RFC standard states that an email address
should not be composed of a local part (before the '@') longer than
64 bytes and a domain part (after the '@') longer than 255 bytes.
It is possible that Amazon SES misinterprets this limitation as it
checks the length of the combination of the name and the email
address of the sender.

To ensure that this problem is not encountered in the send_email
module of Zulip the length of this combination is now checked
against this limit and the from_name field is removed to only
keep the from_address field when it is necessary in order to
stay below 320 bytes.

If the from_address field alone is longer than 320 bytes the
sending process will raise an SMTPDataError exception.

Tests for this new check are added to the backend test suite in
order to test if build_email correctly outputs an email with filled
from_name and from_address fields when the total length is lower
than 320 bytes and that it correctly throws the from_name field
away when necessary.

Fixes: #17558.
2021-04-03 08:13:26 -07:00
..
data_import import/export: Fix deprecated authentication method for Slack. 2021-03-08 12:56:37 -08:00
lib emails: Truncate overly-long From fields for RFC compatibility. 2021-04-03 08:13:26 -07:00
management support: Create RealmAuditLog when realm reactivation email is sent. 2021-04-03 08:01:46 -07:00
migrations migrations: Subscription.is_user_active denormalization - step two. 2021-03-30 09:29:36 -07:00
openapi streams: Use "archive stream" phrasing instead of "delete stream". 2021-04-02 22:06:48 -07:00
templatetags python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
tests emails: Truncate overly-long From fields for RFC compatibility. 2021-04-03 08:13:26 -07:00
tornado tornado: Explicitly mark requests as varying by cookie. 2021-04-02 14:55:22 -07:00
views support: Create RealmAuditLog when realm reactivation email is sent. 2021-04-03 08:01:46 -07:00
webhooks statuspage: Properly detect the update is for component or incident. 2021-03-30 12:06:09 -07:00
worker outgoing_webhook: Join build_bot_request and send_data_to_server. 2021-03-29 18:24:44 -07:00
__init__.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
apps.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
context_processors.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
decorator.py api: Add REALM_DEACTIVATED error code. 2021-03-31 08:46:13 -07:00
filters.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
forms.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
logging_handlers.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
middleware.py middleware: Do not trust X-Forwarded-For; use X-Real-Ip, set from nginx. 2021-03-31 14:19:38 -07:00
models.py support: Create RealmAuditLog when updating realm_subdomain. 2021-04-03 08:01:46 -07:00
signals.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00