modoboa/modoboa-postfix-autoreply

Auto Reply Error & return to sender

yannfill opened this issue · 9 comments

I see an error with one account that result in a non-delivery notification to the sender:

to=<email@example.com@autoreply.example.com>, orig_to=<email@example.com>, relay=autoreply, delay=0.78, delays=0.14/0/0/0.64, dsn=5.3.0, status=bounced (Command died with status 1: "python". Command output: Traceback (most recent call last): File "/opt/ModoboaWeb/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/dist-packages/modoboa_postfix_autoreply/management/commands/autoreply.py", line 169, in handle send_autoreply(sender, mbox, armessage, original_msg) File "/usr/local/lib/python2.7/dist-packages/modoboa_postfix_autoreply/management/commands/autoreply.py", line 78, in send_autoreply msg.send() File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", line 342, in send return self.get_connection(fail_silently).send_messages([self]) File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 107, in send_messages sent = self._send(message) File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 121, in _send message = email_message.message() File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", line 307, in message msg['Subject'] = self.subject File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", line 232,

What's wrong ?

@yannfill I don't know because the stack trace is not complete...

How can I get the whole stack trace if it is truncated by Postfix ?

Maybe looking at the logs?

That's what I say, it's all I get from Postfix log, the error line is truncated.

The other solution is to send a message to this account and wait for the NDR message, it should contain the error too...

It's happening randomly, I can't reproduce it yet.

Looks like an issue with newlines in Subject header. I thought #42 fixed it... @gawel ?

Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    execute_from_command_line(sys.argv) 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute() 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options) 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_postfix_autoreply/management/commands/autoreply.py", line 169, in handle
    send_autoreply(sender, mbox, armessage, original_msg) 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_postfix_autoreply/management/commands/autoreply.py", line 78, in send_autoreply
    msg.send()
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/mail/message.py", line 342, in send
    return self.get_connection(fail_silently).send_messages([self]) 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 107, in send_messages
    sent = self._send(message) 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 121, in _send
    message = email_message.message() 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/mail/message.py", line 307, in message 
    msg['Subject'] = self.subject 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/mail/message.py", line 232, in __setitem__ 
    name, val = forbid_multi_line_headers(name, val, self.encoding) 
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/mail/message.py", line 92, 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 u'Auto: I am currently out of the office Re: Fwd: RE: Picked Up Issued Garnishment - No JJL Record - JJL to Serve?\n (Georgia)' for header u'Subject')

According to line numbers, those errors are not caused by the latest version of this plugin... Please make sure you're using the latest version.