Fetchmail: do not use "no bouncemail"
Hi, I put "set no spambounce" in my "fetchmailrc" file, in order to avoid bouncing mails each time I rejected a mail because it contained a .pif file (as comented in another thread). That worked, the bounce is directed instead to the local postmaster (ie, me), but it has an unforeseen side effect: that the rejected mail itself is not flushed from the server: Sep 6 11:19:35 nimrodel fetchmail[4044]: SMTP>. (EOM) Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP< 550 Error: "*** DOS/WIN executables rejected ***" Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP error: 550 Error: "*** DOS/WIN executables rejected ***" ... Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP> QUIT Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP< 221 Bye Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP> RSET Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP< 250 Ok Sep 6 11:19:36 nimrodel fetchmail[4044]: not flushed <----- Sep 6 11:19:36 nimrodel fetchmail[4044]: POP3> RETR 10 Sep 6 11:19:37 nimrodel fetchmail[4044]: POP3< +OK 101580 bytes If I remove the "set no spambounce" line I have: Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP< 550 Error: "*** DOS/WIN executables rejected ***" Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP error: 550 Error: "*** DOS/WIN executables rejected ***" ... Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP>. (EOM) Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP< 250 Ok: queued as D408A29F3A Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP> QUIT Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP< 221 Bye Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP listener refused delivery Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP> RSET Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP< 250 Ok Sep 5 19:14:13 nimrodel fetchmail[3932]: flushed Sep 5 19:14:13 nimrodel fetchmail[3932]: POP3> DELE 17 <------ Sep 5 19:14:14 nimrodel fetchmail[3932]: POP3< +OK message marked for deletion Sep 5 19:14:14 nimrodel fetchmail[3932]: POP3> RETR 18 Sep 5 19:14:14 nimrodel fetchmail[3932]: POP3< +OK 100351 bytes So I have to accept that fetchmail tries to send it's bouncemail. If not, it will leave rejected mail in the POP server, undeleted, and fetched and rejected again every cicle (I have "fetchall" activated for other reasons) o or left unremoved for ever; that lead me to think I was getting 50 of those per hour :-( Which leaves me with another problem: how to tell postfix NOT to send emails comming from fetchmail-daemon, because as I don't have a real domain they get rejected at the other end, of course. And they are useless, those people did not send those email with .pif files. -- Cheers, Carlos Robinson
Carlos E. R. wrote:
I put "set no spambounce" in my "fetchmailrc" file, in order to avoid bouncing mails each time I rejected a mail because it contained a .pif file (as comented in another thread). That worked, the bounce is directed instead to the local postmaster (ie, me), but it has an unforeseen side effect: that the rejected mail itself is not flushed from the server:
Sep 6 11:19:35 nimrodel fetchmail[4044]: SMTP>. (EOM) Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP< 550 Error: "*** DOS/WIN executables rejected ***" Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP error: 550 Error: "*** DOS/WIN executables rejected ***" ... Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP> QUIT Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP< 221 Bye Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP> RSET Sep 6 11:19:36 nimrodel fetchmail[4044]: SMTP< 250 Ok Sep 6 11:19:36 nimrodel fetchmail[4044]: not flushed <----- Sep 6 11:19:36 nimrodel fetchmail[4044]: POP3> RETR 10 Sep 6 11:19:37 nimrodel fetchmail[4044]: POP3< +OK 101580 bytes
If I remove the "set no spambounce" line I have:
Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP< 550 Error: "*** DOS/WIN executables rejected ***" Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP error: 550 Error: "*** DOS/WIN executables rejected ***" ... Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP>. (EOM) Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP< 250 Ok: queued as D408A29F3A Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP> QUIT Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP< 221 Bye Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP listener refused delivery Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP> RSET Sep 5 19:14:13 nimrodel fetchmail[3932]: SMTP< 250 Ok Sep 5 19:14:13 nimrodel fetchmail[3932]: flushed Sep 5 19:14:13 nimrodel fetchmail[3932]: POP3> DELE 17 <------ Sep 5 19:14:14 nimrodel fetchmail[3932]: POP3< +OK message marked for deletion Sep 5 19:14:14 nimrodel fetchmail[3932]: POP3> RETR 18 Sep 5 19:14:14 nimrodel fetchmail[3932]: POP3< +OK 100351 bytes
So I have to accept that fetchmail tries to send it's bouncemail. If not, it will leave rejected mail in the POP server, undeleted, and fetched and rejected again every cicle (I have "fetchall" activated for other reasons) o or left unremoved for ever; that lead me to think I was getting 50 of those per hour :-(
Fetchmail couldn't know that this mail is to be handled as spam. You have to tell fetchmail, that the errorcode 550 from the mta is spam (See Option "antispam" and set it to "antispam 550"). And of course see the section in "man fetchmail".
Which leaves me with another problem: how to tell postfix NOT to send emails comming from fetchmail-daemon, because as I don't have a real domain they get rejected at the other end, of course. And they are useless, those people did not send those email with .pif files.
-- Andreas
The 03.09.07 at 20:41, Andreas Winkelmann wrote:
Fetchmail couldn't know that this mail is to be handled as spam. You have to tell fetchmail, that the errorcode 550 from the mta is spam (See Option "antispam" and set it to "antispam 550"). And of course see the section in "man fetchmail".
Notice that the man page doesn't say that using the nobounce option implies not flushing the bounced mail. That behaviour is not documented. If I remove the nobounce option, then it is flushed, as it should be. The --nobounce option suppresses the normal action of bouncing errors back to the sender in an RFC1894-confor mant error message. If nobounce is on, the message will go to the postmaster instead. ... set no bouncemail Direct error mail to postmaster rather than sender ... If fetchmail cannot match any mailserver usernames or localdomain addresses, the mail will be bounced. Normally it will be bounced to the sender, but if `nobounce' is on it will go to the postmaster (which in turn defaults to being the calling user).
Which leaves me with another problem: how to tell postfix NOT to send emails comming from fetchmail-daemon,
Aparently this could be done with: /^From:.*fetchmail-daemon\@nimrodel\.valinor HOLD in the /etc/postfix/header_checks file. But it doesn't work. -- Cheers, Carlos Robinson
Carlos E. R. wrote:
Fetchmail couldn't know that this mail is to be handled as spam. You have to tell fetchmail, that the errorcode 550 from the mta is spam (See Option "antispam" and set it to "antispam 550"). And of course see the section in "man fetchmail".
Notice that the man page doesn't say that using the nobounce option implies not flushing the bounced mail. That behaviour is not documented. If I remove the nobounce option, then it is flushed, as it should be.
The --nobounce option suppresses the normal action of bouncing errors back to the sender in an RFC1894-confor mant error message. If nobounce is on, the message will go to the postmaster instead. ... set no bouncemail Direct error mail to postmaster rather than sender ... If fetchmail cannot match any mailserver usernames or localdomain addresses, the mail will be bounced. Normally it will be bounced to the sender, but if `nobounce' is on it will go to the postmaster (which in turn defaults to being the calling user).
Ok, a few lines from fetchmail's manpage: ... Return codes which fetchmail treats as antispam responses and discards the message can be set with the `antispam' option. This is one of the only three circumstance under which fetchmail ever discards mail (the others are the 552 and 553 errors described below, and the suppression of multidropped messages with a message-ID already seen). ... In short, only errors 552 and 553 without the antispam-option lets fetchmail delete the mail from the server. And of course double msg-ids. In your case the best choice will be "antispam 550" so the mail will be deleted directly from the server, and if you want to supress bounce-mails set "spambounce" to no. But maybe i had misunderstood you.
Which leaves me with another problem: how to tell postfix NOT to send emails comming from fetchmail-daemon,
Aparently this could be done with:
/^From:.*fetchmail-daemon\@nimrodel\.valinor HOLD
in the /etc/postfix/header_checks file. But it doesn't work.
Is HOLD really what you want? Turn on verbose logging in Postfix (master.cf) and view the logs. -- Andreas
The 03.09.08 at 15:23, Andreas Winkelmann wrote:
Ok, a few lines from fetchmail's manpage:
... Return codes which fetchmail treats as antispam responses and discards the message can be set with the `antispam' option. This is one of the only three circumstance under which fetchmail ever discards mail (the others are the 552 and 553 errors described below, and the suppression of multidropped messages with a message-ID already seen). ...
In short, only errors 552 and 553 without the antispam-option lets fetchmail delete the mail from the server. And of course double msg-ids.
In your case the best choice will be "antispam 550" so the mail will be deleted directly from the server, and if you want to supress bounce-mails set "spambounce" to no.
Notice that the 550 response also causes mail to be deleted from the server (verified by experiment); in theory, it has ben downloaded and bounced back, so it can be deleted. That works. What it happens is that if I set the nobounce option, the bounce mail goes instead to me (good), but it also means that the original mail is not deleted from the server. What I'm saying is that the behaviour of deleting or not deleting changes if I use the nobouncemail option, and that is not documented.
But maybe i had misunderstood you.
I could treat it as spam - which it is, in this case - but it could be a legitimate mail containing an atachement which I reject automatically. I don't think that treating all rejects as spam is correct.
Which leaves me with another problem: how to tell postfix NOT to send emails comming from fetchmail-daemon,
Aparently this could be done with:
/^From:.*fetchmail-daemon\@nimrodel\.valinor HOLD
There was a missing "/" at the end (valinor/). It is working now.
in the /etc/postfix/header_checks file. But it doesn't work.
Is HOLD really what you want?
Not really. I want it redirected for manual inspection and deletion. I'm
thinking of using "reject", which probably would send them back to the
user "fetchmail-daemon", which is the postmaster... I will try that right
away [...] No, it is worse:
Sep 8 16:50:46 nimrodel postfix/cleanup[8423]: DBF2ACAF86: reject: header
From: FETCHMAIL-DAEMON@nimrodel.valinor from localhost[127.0.0.1];
from=
Turn on verbose logging in Postfix (master.cf) and view the logs.
It is an idea... -- Cheers, Carlos Robinson
Carlos E. R. wrote:
The 03.09.08 at 15:23, Andreas Winkelmann wrote:
Ok, a few lines from fetchmail's manpage:
... Return codes which fetchmail treats as antispam responses and discards the message can be set with the `antispam' option. This is one of the only three circumstance under which fetchmail ever discards mail (the others are the 552 and 553 errors described below, and the suppression of multidropped messages with a message-ID already seen). ...
In short, only errors 552 and 553 without the antispam-option lets fetchmail delete the mail from the server. And of course double msg-ids.
In your case the best choice will be "antispam 550" so the mail will be deleted directly from the server, and if you want to supress bounce-mails set "spambounce" to no.
Notice that the 550 response also causes mail to be deleted from the server (verified by experiment); in theory, it has ben downloaded and bounced back, so it can be deleted. That works.
What it happens is that if I set the nobounce option, the bounce mail goes instead to me (good), but it also means that the original mail is not deleted from the server.
What I'm saying is that the behaviour of deleting or not deleting changes if I use the nobouncemail option, and that is not documented.
Yeah, you're right, i found it in the source. ... /* handle SMTP errors based on the content of SMTP_response */ /* return of PS_REFUSED deletes mail from the server; PS_TRANSIENT keeps it */ ... return(run.bouncemail ? PS_REFUSED : PS_TRANSIENT); ... This means if run.bouncemail is true, the function returns PS_REFUSED. If run.bouncemail is false return with PS_TRANSIENT.
But maybe i had misunderstood you.
I could treat it as spam - which it is, in this case - but it could be a legitimate mail containing an atachement which I reject automatically. I don't think that treating all rejects as spam is correct.
I don't know if it is only undocumented or is a bug. Maybe you want to change it and recompile fetchmail.
Which leaves me with another problem: how to tell postfix NOT to send emails comming from fetchmail-daemon,
Aparently this could be done with:
/^From:.*fetchmail-daemon\@nimrodel\.valinor HOLD
There was a missing "/" at the end (valinor/). It is working now.
in the /etc/postfix/header_checks file. But it doesn't work.
Is HOLD really what you want?
Not really. I want it redirected for manual inspection and deletion. I'm thinking of using "reject", which probably would send them back to the user "fetchmail-daemon", which is the postmaster... I will try that right away [...] No, it is worse:
Sep 8 16:50:46 nimrodel postfix/cleanup[8423]: DBF2ACAF86: reject: header From: FETCHMAIL-DAEMON@nimrodel.valinor from localhost[127.0.0.1]; from=
to= proto=ESMTP helo=<localhost>: Message content rejected Sep 8 16:50:47 nimrodel amavis[8416]: Rejected by MTA: 550 End data with <CR><LF>.<CR><LF> Error: Message content rejected
REDIRECT is supported in an actual snapshot from Postfix, not in a release. And of course not in the suse-postfix. -- Andreas
The 03.09.08 at 20:24, Andreas Winkelmann wrote:
I could treat it as spam - which it is, in this case - but it could be a legitimate mail containing an atachement which I reject automatically. I don't think that treating all rejects as spam is correct.
I don't know if it is only undocumented or is a bug. Maybe you want to change it and recompile fetchmail.
Mmm... it is an idea, it would solve my problem... I'll only have to remember when I update the system one day :-)
Sep 8 16:50:47 nimrodel amavis[8416]: Rejected by MTA: 550 End data with <CR><LF>.<CR><LF> Error: Message content rejected
REDIRECT is supported in an actual snapshot from Postfix, not in a release. And of course not in the suse-postfix.
Argh. Pity. Then I'll have to touch fetchmail. -- Cheers, Carlos Robinson
participants (2)
-
Andreas Winkelmann
-
Carlos E. R.