Skip to content

Commit 748c958

Browse files
Document trailing newline behavior in set_content()
1 parent 9c08f40 commit 748c958

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Doc/library/email.message.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,13 @@ message objects.
612612
*content_manager* is not specified, use the ``content_manager`` specified
613613
by the current :mod:`~email.policy`.
614614

615+
Note that this method will append a newline character to the end of the
616+
content, if it wasn't passed already. For example, the following are equivalent ::
617+
618+
msg = EmailMessage()
619+
msg.set_content("hello")
620+
msg.set_content("hello\n")
621+
615622

616623
.. method:: make_related(boundary=None)
617624

0 commit comments

Comments
 (0)