Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/596.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent bare line feed rejection errors by using CRLF line endings when sending emails. Contributed by @NICO-SOLUTIONS.
6 changes: 5 additions & 1 deletion sydent/util/emailutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ def sendEmail(
# failing it may munge the address it returns. So we should *not* use
# that parsed address, as it may not match any validation done
# elsewhere.
smtp.sendmail(mailFrom, mailTo, mailString.encode("utf-8"))
# Replace the line endings (typically "\n") with "\r\n" (CRLF) as required by email.
# This avoids "550 5.6.11 SMTPSEND.BareLinefeedsAreIllegal" errors when
# sending to strict mail servers.
mailStringCRLF = "\r\n".join(mailString.splitlines())
Comment thread
anoadragon453 marked this conversation as resolved.
smtp.sendmail(mailFrom, mailTo, mailStringCRLF.encode("utf-8"))
smtp.quit()
except Exception as origException:
if log_send_errors:
Expand Down
Loading