1
0
mirror of https://github.com/django/django.git synced 2025-08-08 02:49:26 +00:00

Edited docs/email.txt changes from [5547]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5561 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-06-30 21:03:41 +00:00
parent 8cea4c7c5e
commit 918738919e

View File

@ -203,7 +203,7 @@ e-mail, you can subclass these two classes to suit your needs.
This is a design feature. ``send_mail()`` and related functions were This is a design feature. ``send_mail()`` and related functions were
originally the only interface Django provided. However, the list of originally the only interface Django provided. However, the list of
parameters they accepted was slowly growing over time. It made sense to parameters they accepted was slowly growing over time. It made sense to
move to a more object-oriented design for e-mail messages and retain the move to a more object-oriented design for e-mail messages and retain the
original functions only for backwards compatibility. original functions only for backwards compatibility.
@ -213,7 +213,7 @@ the operation. This means you can reuse the same connection (an
``SMTPConnection`` instance) for multiple messages. ``SMTPConnection`` instance) for multiple messages.
E-mail messages E-mail messages
---------------- ---------------
The ``EmailMessage`` class is initialized with the following parameters (in The ``EmailMessage`` class is initialized with the following parameters (in
the given order, if positional arguments are used). All parameters are the given order, if positional arguments are used). All parameters are
@ -274,13 +274,13 @@ The class has the following methods:
* ``attach()`` creates a new file attachment and adds it to the message. * ``attach()`` creates a new file attachment and adds it to the message.
There are two ways to call ``attach()``: There are two ways to call ``attach()``:
* You can pass it a single argument which is an * You can pass it a single argument that is an
``email.MIMBase.MIMEBase`` instance. This will be inserted directly ``email.MIMBase.MIMEBase`` instance. This will be inserted directly
into the resulting message. into the resulting message.
* Alternatively, you can pass ``attach()`` three arguments: * Alternatively, you can pass ``attach()`` three arguments:
``filename``, ``content`` and ``mimetype``. ``filename`` is the name ``filename``, ``content`` and ``mimetype``. ``filename`` is the name
of the file attachment as it will appear in the email, ``content`` is of the file attachment as it will appear in the e-mail, ``content`` is
the data that will be contained inside the attachment and the data that will be contained inside the attachment and
``mimetype`` is the optional MIME type for the attachment. If you ``mimetype`` is the optional MIME type for the attachment. If you
omit ``mimetype``, the MIME content type will be guessed from the omit ``mimetype``, the MIME content type will be guessed from the
@ -298,7 +298,7 @@ The class has the following methods:
message.attach_file('/images/weather_map.png') message.attach_file('/images/weather_map.png')
Sending alternative content types Sending alternative content types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is often useful to include multiple versions of the content in an e-mail. It is often useful to include multiple versions of the content in an e-mail.
For instance, sending both text and HTML versions of an e-mail. You can do For instance, sending both text and HTML versions of an e-mail. You can do
@ -332,7 +332,7 @@ always be ``"text"``, but you can change to the subtype. For example::
msg.send() msg.send()
SMTP network connections SMTP network connections
------------------------- ------------------------
The ``SMTPConnection`` class is initialized with the host, port, username and The ``SMTPConnection`` class is initialized with the host, port, username and
password for the SMTP server. If you don't specify one or more of those password for the SMTP server. If you don't specify one or more of those