| 221 | | The ``EmailMessage`` class is initialized as follows:: |
|---|
| 222 | | |
|---|
| 223 | | email = EmailMessage(subject, body, from_email, to, |
|---|
| 224 | | bcc, connection, attachments) |
|---|
| 225 | | |
|---|
| 226 | | All of these parameters are optional. If ``from_email`` is omitted, the value |
|---|
| 227 | | from ``settings.DEFAULT_FROM_EMAIL`` is used. Both the ``to`` and ``bcc`` |
|---|
| 228 | | parameters are lists of addresses, as strings. The ``attachments`` parameter is |
|---|
| 229 | | a list containing either ``(filename, content, mimetype)`` triples of |
|---|
| 230 | | ``email.MIMEBase.MIMEBase`` instances. |
|---|
| | 221 | The ``EmailMessage`` class is initialized with the following parameters (in |
|---|
| | 222 | the given order, if positional arguments are used). All parameters are |
|---|
| | 223 | optional and can be set at any time prior to calling the ``send()`` method. |
|---|
| | 224 | |
|---|
| | 225 | * ``subject``: The subject line of the e-mail. |
|---|
| | 226 | |
|---|
| | 227 | * ``body``: The body text. This should be a plain text message. |
|---|
| | 228 | |
|---|
| | 229 | * ``from_email``: The sender's address. Both ``fred@example.com`` and |
|---|
| | 230 | ``Fred <fred@example.com>`` forms are legal. If omitted, the |
|---|
| | 231 | ``DEFAULT_FROM_EMAIL`` setting is used. |
|---|
| | 232 | |
|---|
| | 233 | * ``to``: A list or tuple of recipient addresses. |
|---|
| | 234 | |
|---|
| | 235 | * ``bcc``: A list or tuple of addresses used in the "Bcc" header when |
|---|
| | 236 | sending the e-mail. |
|---|
| | 237 | |
|---|
| | 238 | * ``connection``: An ``SMTPConnection`` instance. Use this parameter if |
|---|
| | 239 | you want to use the same conneciton for multiple messages. If omitted, a |
|---|
| | 240 | new connection is created when ``send()`` is called. |
|---|
| | 241 | |
|---|
| | 242 | * ``attachments``: A list of attachments to put on the message. These can |
|---|
| | 243 | be either ``email.MIMEBase.MIMEBase`` instances, or ``(filename, |
|---|
| | 244 | content, mimetype)`` triples. |
|---|
| | 245 | |
|---|
| | 246 | * ``headers``: A dictionary of extra headers to put on the message. The |
|---|
| | 247 | keys are the header name, values are the header values. It is up to the |
|---|
| | 248 | caller to ensure header names and values are in the correct format for |
|---|
| | 249 | an e-mail message. |
|---|