简体   繁体   中英

Postfix “bad sender address syntax” causes fetchmail to re-fetch the same email repeatedly

I use fetchmail to retrieve email from an IMAP server every five minutes, passing it to a local postfix process for delivery. The problem: sometimes an email has an invalid "From" line (usually spam), like this one with a leading hyphen:

From: "- Some Dumb Spammer" <-DumbSpammer@example.com>

In this case, fetchmail retrieves the email and passes it to my local postfix process, which 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 says 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 (eg, permitting leading hyphens)? Thank you.

The kind people on the fetchmail-users mailing list answered my question . To summarize their response, you can use fetchmail --nosoftbounce to permanently delete undeliverable messages, use the antispam option to accept the emails ( fetchmail -Z 501 ), or configure postfix to permit leading hyphens if it's safe to do so. The options are documented on the fetchmail man page.

Remove Asp TAG username 'admin@seudominio.com.br' == admin@seudominio.com.br :

#!/bin/sh
set logfile '/var/log/fetchmaillog'
set no bouncemail
defaults  fetchall

poll locapack.com.br with protocol pop3
       username admin@seudominio.com.br password xxxx is admin@seudominio.com.br here;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM