[New-bugs-announce] [issue26426] email examples: incorrect use of email.headerregistry.Address

Jakub Wilk report at bugs.python.org
Wed Feb 24 08:37:42 EST 2016

New submission from Jakub Wilk:

https://docs.python.org/3/library/email-examples.html#examples-using-the-provisional-api contains the following code:

from email.headerregistry import Address
msg['From'] = Address("Pepé Le Pew", "pepe at example.com")
msg['To'] = (Address("Penelope Pussycat", "penelope at example.com"),
             Address("Fabrette Pussycat", "fabrette at example.com"))

But Address takes just the username, not the whole email address, as the second argument. So this should be written as:

msg['From'] = Address("Pepé Le Pew", "pepe", "example.com")


msg['From'] = Address("Pepé Le Pew", addr_spec="pepe at example.com")

assignee: docs at python
components: Documentation
messages: 260796
nosy: docs at python, jwilk
priority: normal
severity: normal
status: open
title: email examples: incorrect use of email.headerregistry.Address

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list