mirror of
https://github.com/modoboa/modoboa-postfix-autoreply.git
synced 2026-04-25 08:35:53 +03:00
[GH-ISSUE #70] Autoreply error (Header values can't contain newline) #38
Labels
No labels
bug
bug
enhancement
enhancement
enhancement
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-postfix-autoreply-modoboa#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @whiteSpaceX on GitHub (Aug 5, 2020).
Original GitHub issue: https://github.com/modoboa/modoboa-postfix-autoreply/issues/70
Morning, since I updated to Modoboa 1.15 with Django 3.6 and Postfix-autoreply 1.6.0. I am getting this error sending emails to an account with autoreply on:
Remote Server returned 'XXX X.X.X < #5.3.0 x-unix; Traceback (most recent call last): File "/srv/modoboa/instance/manage.py", line 22, in execute_from_command_line(sys.argv) File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/srv/modoboa/env/lib/python3.7/site-packages/modoboa_postfix_autoreply/management/commands/autoreply.py", line 214, in handle send_autoreply(sender, mbox, armessage, original_msg) File "/srv/modoboa/env/lib/python3.7/site-packages/modoboa_postfix_autoreply/management/commands/autoreply.py", line 107, in send_autoreply msg.send() File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/mail/message.py", line 291, in send return self.get_connection(fail_silently).send_messages([self]) File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 110, in send_messages sent = self._send(message) File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 124, in _send message = email_message.message() File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/mail/message.py", line 275, in message msg[name] = value File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/mail/message.py", line 169, in setitem name, val = forbid_multi_line_headers(name, val, self.encoding) File "/srv/modoboa/env/lib/python3.7/site-packages/django/core/mail/message.py", line 60, in forbid_multi_line_headers raise BadHeaderError("Header values can't contain newlines (got %r for header %r)" % (val, name)) django.core.mail.message.BadHeaderError: Header values can't contain newlines (got '\n AM0PR03MB553776DDF4AEA9363446D10FB94B0@AM0PR03MB5537.eurprd03.prod.outlook.com' for header 'In-Reply-To')>'
@lmfrazao commented on GitHub (Nov 19, 2020):
Hello, using modoboa 1.17 and python 3.6
still have this problem.
is there any way to fix this ?
update python to 3.7 or 3.8 can fix this ?
thank you.
@harryfoster commented on GitHub (Jul 16, 2021):
Exact same thing for myself. I think it's only particular clients (Outlook?) and when replying to an email:
Modoboa | 1.17.0
Postfix autoreply | 1.6.0
I think it gets incorporated at this location in /modoboa_postfix_autoreply/management/commands/autoreply.py:
Outlook for some reason puts the Message_ID on new line, where as most other MTAs don't. We end up then carrying that /n over to the In-Reply-To header which Django doesn't like due to forbid_multi_line_headers. Maybe a quick newline strip() will sort this? This is just a quick glance, I haven't sat down with a debugger.
I'm going to experiment on my dev box.
@lmfrazao commented on GitHub (Jul 19, 2021):
Still have that problem, only tested on outlook.
Luís Frazão | Bild Corp
+351 914120170
www.bild.pt
From: Harry Foster @.>
Sent: Friday, July 16, 2021 10:33:09 AM
To: modoboa/modoboa-postfix-autoreply @.>
Cc: lmfrazao @.>; Comment @.>
Subject: Re: [modoboa/modoboa-postfix-autoreply] Autoreply error (Header values can't contain newline) (#70)
Exact same thing for myself. I think it's only particular clients (Outlook?) and when replying to an email:
Modoboa | 1.17.0
Postfix autoreply | 1.6.0
I think it gets incorporated at this location:
message_id = original_msg.get("Message-ID")
if message_id:
headers.update({"In-Reply-To": message_id, "References": message_id})
Outlook for some reason puts the Message_ID on new line, where as most other MTAs don't. We end up then carrying that /n over to the In-Reply-To header which Django doesn't like due to forbid_multi_line_headers. Maybe a quick newline strip() will sort this? This is just a quick glance, I haven't sat down with a debugger.
I'm going to experiment on my dev box.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/modoboa/modoboa-postfix-autoreply/issues/70#issuecomment-881312295, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AICKR6UIXL4NZ2INWAFCLOLTX74FLANCNFSM4PVDTVGA.
@call2pedro commented on GitHub (Oct 19, 2021):
I have same issue here at my box. Many times for Office 365 autoreply do not work as should and generates error as you mentioned.