Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#31050 closed Cleanup/optimization (wontfix)

EmailMessage doesn't strip empty addresses from recipients in message headers

Reported by: Konstantin Alekseev Owned by: nobody
Component: Core (Mail) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Example

        email = EmailMessage(
            'Subject', 'Content', 'from@example.com', ['to@example.com', ''],
            cc=['cc@example.com', ''],
            bcc=['', 'bcc@example.com'],
            reply_to=['', None],
        )

        msg = email.message()
        msg['To'] == 'to@example.com, '
        msg['Cc'] == ', cc@example.com'
        msg['Reply-To'] == ', None'

Fix https://github.com/django/django/pull/12164

Change History (2)

comment:1 by Mariusz Felisiak, 5 years ago

Resolution: wontfix
Status: newclosed
Type: BugCleanup/optimization
Version: 2.2master

EmailMessage it's not responsible for sanitizing an input and should not strip any email addresses. You should validate them before passing to the EmailMessage.

comment:2 by Konstantin Alekseev, 5 years ago

EmailMessage it's not responsible for sanitizing an input and should not strip any email addresses

EmailAddress.recipients inconsistent with that statement, it strips empty emails as a result actual email headers are not equal its result.

Note: See TracTickets for help on using tickets.
Back to Top