python / cpython

The Python programming language
https://www.python.org
Other
63.42k stars 30.37k forks source link

smtplib: less confusing behaviour when giving incorrect multiple recipients list #88905

Open ac5f27d0-3737-4644-a15f-c3feffad71c2 opened 3 years ago

ac5f27d0-3737-4644-a15f-c3feffad71c2 commented 3 years ago
BPO 44742
Nosy @Perdu
Files
  • test_sendmail.py: Example script of confusing behaviour
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-feature'] title = 'smtplib: less confusing behaviour when giving incorrect multiple recipients list' updated_at = user = 'https://github.com/Perdu' ``` bugs.python.org fields: ```python activity = actor = 'cmatte' assignee = 'none' closed = False closed_date = None closer = None components = [] creation = creator = 'cmatte' dependencies = [] files = ['50182'] hgrepos = [] issue_num = 44742 keywords = [] message_count = 1.0 messages = ['398228'] nosy_count = 1.0 nosy_names = ['cmatte'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue44742' versions = [] ```

    ac5f27d0-3737-4644-a15f-c3feffad71c2 commented 3 years ago

    When giving recipients in a string format ("email1, email2") to sendmail(), an email is sent to the first email in the list only. This is not a bug since the documentation indicates that sendmail() takes either a list of addresses, or a single address in a string. However, this error is easy to make since the "To:" field expects a comma-separated series of email addresses in a string format.

    I suggest either that:

    Attached is an example script to test confusing behaviour (email is sent to email1@mydomain.com only):