I've got a problem with my POP3 provider delivering me e-mails with broken Return-Path header. When it's long, it gets wrongly folded into multiple lines, in the middle of e-mail address like this:

Return-Path: <bounce-md_30050491.5f06fc4d.v1-e20857b41e04493380b808e01cb6b51
 [email protected]>

Therefore, Postfix returns error and I get bounces from Fetchmail:

fetchmail: SMTP error: 501 5.1.7 Bad sender address syntax

I've read about Fetchmail's -Z option, but I don't want to discard these mails, they are important and not spam.

Is there a possibility to make Postfix treat this special case gracefully and return no error message? Or maybe someone knows a better solution to this problem?

  • What king of mailbox do you use? [ mailbox (file) / maildir ]
    – AnFi
    Nov 16, 2020 at 18:18
  • 1
    Maildir is my king! ;-) Nov 17, 2020 at 19:55

2 Answers 2


fetchmail: direct delivery mailbox/maildir using procmail/maildrop

You can make fetchamil use procmail (or maildrop) to deliver messages directly to mailbox (mailbox file or maildir) without sending it via SMTP. Your procmail script may even unfold Return-Path:.

see mdaoption in man fetchmail

I have used similar solution with custom per email account procmail scripts.


poll pop.provider.net proto pop3
  user "jsmith" with pass "secret1"
  mda /usr/bin/procmail -m .procmailrc-provider.net


 # Debugging settings
 # log all dignostic info to ~/procmail.log
 # log abstracts of delivered messages
 # Subject:`,`From:`, size, final destination 
 # Turn on extended diagnostic

 # deliver everttyting to maildir (tailing /) located in directory ~/.maildir 


fetchamil: -v (or even -v -v) command line options
procmail:LOFILE and LOGABSTRACT settings in procmailrc file

  • Thanks. But this method seems to hacky for me. I tried to use Postfix header_checks and IGNORE the problematic line with /^Return-Path: .* / IGNORE, but after configuring header checks with postconf -e 'header_checks = regexp:/etc/postfix/header_checks' and successful test with postmap -hmq, I still get an error. Do you think header_checks is a good solution and it's a matter of error in my configuration? Or the idea is for some reason totally bad? Nov 18, 2020 at 15:22
  • I am not postix expert. I personally prefer making fetchmail deliver directly to user's local mailbox without SMTP server.
    – AnFi
    Nov 18, 2020 at 16:13
  • Actually I think I've found out why Postfix does not do header check, by running fetchmail -v: ``` fetchmail: SMTP> MAIL FROM:<[email protected]. net> SIZE=37416 fetchmail: SMTP< 501 5.1.7 Bad sender address syntax fetchmail: SMTP error: 501 5.1.7 Bad sender address syntax ``` Nov 18, 2020 at 22:40
  • Unfortunately, this does not work for me. maybe I have an error somewhere, I don't know. Nov 19, 2020 at 2:24
  • Have you started fetchamil in verbose mode? Do ou want verbose mode hinsts for procmail?
    – AnFi
    Nov 19, 2020 at 6:07

Another thing to do could be totally bypass fetchmail and just configure pop3 provider to forward all emails to my email address on the server. Unfortunately, my provider does not have this option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .