| 1 |
.. py:currentmodule:: aiosmtplib |
| 2 |
|
| 3 |
Timeouts |
| 4 |
======== |
| 5 |
|
| 6 |
The :func:`send` coroutine and most :class:`SMTP` operations ( |
| 7 |
:meth:`SMTP.__init__`, :meth:`SMTP.connect`, and most command operations, e.g. |
| 8 |
:meth:`SMTP.ehlo`) accept a ``timeout`` keyword argument of a numerical value |
| 9 |
in seconds. This value is used for all socket operations (initial connection, |
| 10 |
STARTTLS, each command/response, etc), and will raise :exc:`.SMTPTimeoutError` |
| 11 |
if exceeded. |
| 12 |
|
| 13 |
.. warning:: Note that because the timeout is on socket operations, as long as |
| 14 |
there is no period of inactivity that exceeds it (meaning no individual bytes |
| 15 |
sent or received), the timeout will not be triggered. This means that if you |
| 16 |
set the timeout to 1 second (for example), sending an entire message might |
| 17 |
take much longer than that *without* a timeout occurring. |
| 18 |
|
| 19 |
Timeout values passed directly to :class:`SMTP` command methods will override |
| 20 |
the default passed in on initialization. |
| 21 |
|
| 22 |
The default timeout is 60 seconds. |