diff options
| author | SusanTan <onceuponatimeforever@gmail.com> | 2013-10-15 16:18:06 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-10-24 20:38:00 -0400 |
| commit | 4e0a2fe59c8b9c32c2f3111474354356474128a8 (patch) | |
| tree | 23db86643b82c43e3ba78537deeceff1cd89f99d /docs | |
| parent | 9eecb9169566db263e243e4522b08ea1403ee95f (diff) | |
Fixed #21271 -- Added timeout parameter to SMTP EmailBackend.
Thanks Tobias McNulty and Tim Graham for discussions and code review.
Thanks Andre Cruz the suggestion and initial patch.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/1.7.txt | 2 | ||||
| -rw-r--r-- | docs/topics/email.txt | 38 |
2 files changed, 32 insertions, 8 deletions
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index 9312aeaecb..09014980d5 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -248,6 +248,8 @@ Email * :func:`~django.core.mail.send_mail` now accepts an ``html_message`` parameter for sending a multipart ``text/plain`` and ``text/html`` email. +* The SMTP :class:`~django.core.mail.backends.smtp.EmailBackend` now accepts a + :attr:`~django.core.mail.backends.smtp.EmailBackend.timeout` parameter. File Uploads ^^^^^^^^^^^^ diff --git a/docs/topics/email.txt b/docs/topics/email.txt index bfb3765d15..06815c3886 100644 --- a/docs/topics/email.txt +++ b/docs/topics/email.txt @@ -424,16 +424,38 @@ can :ref:`write your own email backend <topic-custom-email-backend>`. SMTP backend ~~~~~~~~~~~~ -This is the default backend. Email will be sent through a SMTP server. -The server address and authentication credentials are set in the -:setting:`EMAIL_HOST`, :setting:`EMAIL_PORT`, :setting:`EMAIL_HOST_USER`, -:setting:`EMAIL_HOST_PASSWORD`, :setting:`EMAIL_USE_TLS` and -:setting:`EMAIL_USE_SSL` settings in your settings file. +.. class:: backends.smtp.EmailBackend([host=None, port=None, username=None, password=None, use_tls=None, fail_silently=False, use_ssl=None, timeout=None, **kwargs]) -The SMTP backend is the default configuration inherited by Django. If you -want to specify it explicitly, put the following in your settings:: + This is the default backend. Email will be sent through a SMTP server. + The server address and authentication credentials are set in the + :setting:`EMAIL_HOST`, :setting:`EMAIL_PORT`, :setting:`EMAIL_HOST_USER`, + :setting:`EMAIL_HOST_PASSWORD`, :setting:`EMAIL_USE_TLS` and + :setting:`EMAIL_USE_SSL` settings in your settings file. - EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' + The SMTP backend is the default configuration inherited by Django. If you + want to specify it explicitly, put the following in your settings:: + + EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' + + Here is an attribute which doesn't have a corresponding settting like the + others described above: + + .. attribute:: timeout + + .. versionadded:: 1.7 + + This backend contains a ``timeout`` parameter, which can be set with + the following sample code:: + + from django.core.mail.backends import smtp + + class MyEmailBackend(smtp.EmailBackend): + def __init__(self, *args, **kwargs): + kwargs.setdefault('timeout', 42) + super(MyEmailBackend, self).__init__(*args, **kwargs) + + Then point the :setting:`EMAIL_BACKEND` setting at your custom backend as + described above. .. _topic-email-console-backend: |
