How to get line breaks in e-mail sent using Python's smtplib?

前端 未结 5 1710
说谎
说谎 2020-12-01 15:36

I have written a script that writes a message to a text file and also sends it as an email. Everything goes well, except the email finally appears to be all in one line.

5条回答
  •  爱一瞬间的悲伤
    2020-12-01 16:20

    Outlook will remove line feeds from plain text it believes are extras. https://support.microsoft.com/en-us/kb/287816

    You can try below update to make the lines look like bullets. That worked for me.

    body = "Dear Student, \n- Please send your report\n- Thank you for your attention"
    

提交回复
热议问题