From: Rob M. <rob...@gm...> - 2014-09-09 17:31:29
|
On 9 September 2014 14:17, Daniel Barrett <dba...@bl...> wrote: > > I use fetchmail to retrieve email from an IMAP server every five > minutes, passing it to a local postfix process on my home Linux box > for delivery. The problem: sometimes an email has an invalid "From" > line (usually spam), like this one with leading hyphens: > > From: "- Some Dumb Spammer" <-Du...@ex...> > > In this case, when fetchmail retrieves the email, the local postfix > process raises an error: > > fetchmail: SMTP error: 501 5.1.7 Bad sender address syntax > > This error causes fetchmail to leave the bad email sitting on the IMAP > server, even when my .fetchmailrc file specifies "nokeep". As a > result, fetchmail re-downloads it every five minutes. Repeat > forever... or until I manually delete the bad email from the IMAP > server. > > What's the best way to break these loops automatically, either > deleting or delivering the bad email, without opening a security hole > (e.g., permitting leading hyphens)? Check the anti-spam option: http://www.fetchmail.info/fetchmail-man.html#29 If you set 501 as a spam code fetchmail will delete any email your Postfix server returns that code for. -- Please keep list traffic on the list. Rob MacGregor Whoever fights monsters should see to it that in the process he doesn't become a monster. Friedrich Nietzsche |