#5615 closed (fixed)
Typo in email docs: "to" field should be a list
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | email to | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
documentation typo on:
http://www.djangoproject.com/documentation/email/#sending-alternative-content-types
The "to" address is not a list:
-fix 1-
orig:
subject, from_email, to = 'hello', 'from@example.com', 'to@example.com'
new:
subject, from_email, to = 'hello', 'from@example.com', ['to@example.com']
--- OR ---
-fix 2-
orig:
msg = EmailMultiAlternatives(subject, text_content, from_email, to)
new:
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
Attachments (1)
Change History (6)
by , 17 years ago
comment:1 by , 17 years ago
Has patch: | set |
---|
comment:2 by , 17 years ago
Keywords: | email to added |
---|---|
Summary: | typo in e-mail documenation: "to" address is a string, not a list → Typo in email docs: "to" field should be a list |
Triage Stage: | Unreviewed → Ready for checkin |
The specific code that this ends up calling is the parent class EmailMessage.init, which does indeed expect a list as it does ','.join() on it soon afterward. I prefer the second fix as you have in your patch, too.
comment:4 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I prefer the second fix since it is consistent with the next example
msg = EmailMessage(subject, html_content, from_email, [to])
msg.content_subtype = "html" # Main content is now text/html
msg.send()
feel free to disagree