Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Side by Side Diff: Doc/library/smtplib.rst

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/signal.rst ('k') | Doc/library/socketserver.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`smtplib` --- SMTP protocol client 1 :mod:`smtplib` --- SMTP protocol client
2 ======================================= 2 =======================================
3 3
4 .. module:: smtplib 4 .. module:: smtplib
5 :synopsis: SMTP protocol client (requires sockets). 5 :synopsis: SMTP protocol client (requires sockets).
6 .. sectionauthor:: Eric S. Raymond <esr@snark.thyrsus.com> 6 .. sectionauthor:: Eric S. Raymond <esr@snark.thyrsus.com>
7 7
8 8
9 .. index:: 9 .. index::
10 pair: SMTP; protocol 10 pair: SMTP; protocol
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 :exc:`SMTPDataError` 341 :exc:`SMTPDataError`
342 The server replied with an unexpected error code (other than a refusal of a 342 The server replied with an unexpected error code (other than a refusal of a
343 recipient). 343 recipient).
344 344
345 Unless otherwise noted, the connection will be open even after an exception i s 345 Unless otherwise noted, the connection will be open even after an exception i s
346 raised. 346 raised.
347 347
348 .. versionchanged:: 3.2 *msg* may be a byte string. 348 .. versionchanged:: 3.2 *msg* may be a byte string.
349 349
350 350
351 .. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, \ 351 .. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=[ ], rcpt_options=[])
352 mail_options=[], rcpt_options=[])
353 352
354 This is a convenience method for calling :meth:`sendmail` with the message 353 This is a convenience method for calling :meth:`sendmail` with the message
355 represented by an :class:`email.message.Message` object. The arguments have 354 represented by an :class:`email.message.Message` object. The arguments have
356 the same meaning as for :meth:`sendmail`, except that *msg* is a ``Message`` 355 the same meaning as for :meth:`sendmail`, except that *msg* is a ``Message``
357 object. 356 object.
358 357
359 If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills 358 If *from_addr* is ``None``, ``send_message`` sets its value to the value of
360 those arguments with addresses extracted from the headers of *msg* as 359 the :mailheader:`From` header from *msg*. If *to_addrs* is ``None``,
361 specified in :rfc:`2822`\: *from_addr* is set to the :mailheader:`Sender` 360 ``send_message`` combines the values (if any) of the :mailheader:`To`,
362 field if it is present, and otherwise to the :mailheader:`From` field. 361 :mailheader:`CC`, and :mailheader:`Bcc` fields from *msg*. Regardless of
363 *to_adresses* combines the values (if any) of the :mailheader:`To`, 362 the values of *from_addr* and *to_addrs*, ``send_message`` deletes any Bcc
364 :mailheader:`Cc`, and :mailheader:`Bcc` fields from *msg*. If exactly one 363 field from *msg*. It then serializes *msg* using
365 set of :mailheader:`Resent-*` headers appear in the message, the regular
366 headers are ignored and the :mailheader:`Resent-*` headers are used instead.
367 If the message contains more than one set of :mailheader:`Resent-*` headers,
368 a :exc:`ValueError` is raised, since there is no way to unambiguously detect
369 the most recent set of :mailheader:`Resent-` headers.
370
371 ``send_message`` serializes *msg* using
372 :class:`~email.generator.BytesGenerator` with ``\r\n`` as the *linesep*, and 364 :class:`~email.generator.BytesGenerator` with ``\r\n`` as the *linesep*, and
373 calls :meth:`sendmail` to transmit the resulting message. Regardless of the 365 calls :meth:`sendmail` to transmit the resulting message.
374 values of *from_addr* and *to_addrs*, ``send_message`` does not transmit any
375 :mailheader:`Bcc` or :mailheader:`Resent-Bcc` headers that may appear
376 in *msg*.
377 366
378 .. versionadded:: 3.2 367 .. versionadded:: 3.2
379 368
380 369
381 .. method:: SMTP.quit() 370 .. method:: SMTP.quit()
382 371
383 Terminate the SMTP session and close the connection. Return the result of 372 Terminate the SMTP session and close the connection. Return the result of
384 the SMTP ``QUIT`` command. 373 the SMTP ``QUIT`` command.
385 374
386 375
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 server = smtplib.SMTP('localhost') 416 server = smtplib.SMTP('localhost')
428 server.set_debuglevel(1) 417 server.set_debuglevel(1)
429 server.sendmail(fromaddr, toaddrs, msg) 418 server.sendmail(fromaddr, toaddrs, msg)
430 server.quit() 419 server.quit()
431 420
432 .. note:: 421 .. note::
433 422
434 In general, you will want to use the :mod:`email` package's features to 423 In general, you will want to use the :mod:`email` package's features to
435 construct an email message, which you can then send 424 construct an email message, which you can then send
436 via :meth:`~smtplib.SMTP.send_message`; see :ref:`email-examples`. 425 via :meth:`~smtplib.SMTP.send_message`; see :ref:`email-examples`.
OLDNEW
« no previous file with comments | « Doc/library/signal.rst ('k') | Doc/library/socketserver.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+