python / cpython

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

SMTPLib sendmail fails on hyphenated adr #36361

Closed 76f1338a-fb28-4803-8134-b879b920af77 closed 22 years ago

76f1338a-fb28-4803-8134-b879b920af77 commented 22 years ago
BPO 537484
Nosy @warsaw

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 = 'https://github.com/warsaw' closed_at = created_at = labels = ['library'] title = 'SMTPLib sendmail fails on hyphenated adr' updated_at = user = 'https://bugs.python.org/shadowlore' ``` bugs.python.org fields: ```python activity = actor = 'barry' assignee = 'barry' closed = True closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'shadowlore' dependencies = [] files = [] hgrepos = [] issue_num = 537484 keywords = [] message_count = 3.0 messages = ['10097', '10098', '10099'] nosy_count = 2.0 nosy_names = ['barry', 'shadowlore'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue537484' versions = [] ```

76f1338a-fb28-4803-8134-b879b920af77 commented 22 years ago

When using smtplib's SMTP.sendmail, if the To: address contains a hyphen, the To: header will be silently dropped.

To duplicate:

Follow the docstring for smtplib.SMTP.sendmail, and use a hyphenated email address, such as foo-help@somewhere.org

warsaw commented 22 years ago

Logged In: YES user_id=12800

I don't believe it. I use smtplib all the time to send messages to Mailman addresses that contain hyphens and I've never seen a problem, going back to Python 1.5.2 and up to Python 2.3(cvs).

Note that as far as the SMTP protocol is concerned, and smtplib as well, the body of the message which contains the To: header, really isn't part of the SMTP dialog. The envelope sender and recipients are the important determining factors in where the message goes and where the message comes from. These are the first two arguments to .sendmail(). The body of the message -- including the headers -- is spit right out to the SMTP server, after canonicalizing stuff like line endings as per the RFC.

Much more likely is that your MTA -- i.e. the thing you're connected to (your SMTP server) -- is munging things.

If you can explain more about your environment, I might be able to help. You should also attach a .py file that exactly reproduces your problem and I will test it with my MTA.

warsaw commented 22 years ago

Logged In: YES user_id=12800

I'm moving this status to Pending; waiting on a response from the submitter.