Code

Opened 7 years ago

Closed 7 years ago

#5042 closed (worksforme)

misleading documentation

Reported by: anonymous Owned by: jacob
Component: Documentation Version: master
Severity: Keywords: EmailMultiAlternatives
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by adrian)

The example script for EmailMultiAlternatives at http://www.djangoproject.com/documentation/email/ is incorrect.

You need to surround the to with [], otherwise you get an error can't add a string to a list.

from django.core.mail import EmailMultiAlternatives

subject, from_email, to = 'hello', 'from@example.com', 'to@example.com'
text_content = 'This is an important message.'
html_content = '<p>This is an <strong>important</strong> message.'
msg = EmailMultiAlternatives(subject, text_content, from_email, to)
msg.attach_alternative(html_content, "text/html")
msg.send()

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by adrian

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Fixed formatting in description.

comment:2 Changed 7 years ago by adrian

  • Resolution set to worksforme
  • Status changed from new to closed

I cannot replicate this problem.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.