Django

Code

Changeset 1923

Show
Ignore:
Timestamp:
01/11/06 21:02:19 (3 years ago)
Author:
adrian
Message:

Added more explanation to docs/email.txt 'Preventing header injection' section.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/email.txt

    r1898 r1923  
    125125The Django e-mail functions outlined above all protect against header injection 
    126126by forbidding newlines in header values. If any ``subject``, ``from_email`` or 
    127 ``recipient_list`` contains a newline, the e-mail function (e.g. 
    128 ``send_mail()``) will raise ``django.core.mail.BadHeaderError`` (a subclass of 
    129 ``ValueError``) and, hence, will not send the e-mail. It's your responsibility 
    130 to validate all data before passing it to the e-mail functions. 
     127``recipient_list`` contains a newline (in either Unix, Windows or Mac style), 
     128the e-mail function (e.g. ``send_mail()``) will raise 
     129``django.core.mail.BadHeaderError`` (a subclass of ``ValueError``) and, hence, 
     130will not send the e-mail. It's your responsibility to validate all data before 
     131passing it to the e-mail functions. 
     132 
     133If a ``message`` contains headers at the start of the string, the headers will 
     134simply be printed as the first bit of the e-mail message. 
    131135 
    132136Here's an example view that takes a ``subject``, ``message`` and ``from_email``