The commit 0dba9d6 changed msg=msg.as_string() to msg=msg.as_bytes() when sending a message, but the as_bytes() override in utils.py defaults to \n as linesep and is called without arguments.
As smtplib converts single \n or \r to \r\n automatically with regular strings, but does not touch byte strings, this causes emails to be generated and sent with LF as the line seperator instead of the correct CRLF, which can cause a violation of RFC5321 section 4.5.3.1.6 with messages that become longer than 998 bytes.
msg.as_bytes() should be called with linesep='\r\n' to fix this.
The commit 0dba9d6 changed
msg=msg.as_string()tomsg=msg.as_bytes()when sending a message, but theas_bytes()override inutils.pydefaults to\naslinesepand is called without arguments.As smtplib converts single
\nor\rto\r\nautomatically with regular strings, but does not touch byte strings, this causes emails to be generated and sent withLFas the line seperator instead of the correctCRLF, which can cause a violation of RFC5321 section 4.5.3.1.6 with messages that become longer than 998 bytes.msg.as_bytes()should be called withlinesep='\r\n'to fix this.