Any fetchmail(1) gurus here?

Mark Ovens mark at ukug.uk.freebsd.org
Sat Nov 20 20:00:59 GMT 2004


I thought that this was going to be simple, but it hasn't worked out 
that way.

I've got postfix, fetchmail and courier-imap running on a FreeBSD 4.10 
machine.

I'm simply trying to get fetchmail(1) to pull mails to two users from a 
single ISP mailserver - separate mailboxes, but bounce any that aren't 
addressed to the recipient - i.e. spam.

Using this .fetchmailrc

poll pop.myisp.com protocol POP3
         user marko with pass "xxxxx" is user mark here
         user maureeno with pass "yyyyy" is user maureen here

*everything* gets bounced to postmaster - I see this in the fetchmail log

fetchmail: no local matches, forwarding to postmaster

Changing .fetchmailrc to

poll pop.myisp.com protocol POP3 localdomains myisp.com
         user marko with pass "xxxxx" is user * here
         user maureeno with pass "yyyyy" is user * here

kind of works in that fetchmail now passes *all* mail to postfix 
(because myisp.com matches) unaltered so if the mail is addressed to say 
foobar at myisp.com postfix rejects it and the next time fetchmail polls 
the server the message gets deleted.

This achieves the objective but seems a bit complicated as it is postfix 
that is doing the actual bouncing. According to the manpage fetchmail 
itself should be able to bounce mails not addressed to (in this case) 
marko or maureeno :

"A single local name can be used to support redirecting your mail when 
your username on the client machine is different from your name on the 
mailserver. When there is only a single local name, mail is forwarded to 
that local username regardless of the message’s Received, To, Cc, and 
Bcc headers. In this case fetchmail never does DNS lookups."

Well, it doesn't forward it to the local username, it forwards it to 
postmaster (using the first .fetchmailrc above, with the single username).

"When there is more than one local name (or name mapping) the fetchmail 
code does look at the Received, To, Cc, and Bcc headers of retrieved 
mail (this is ‘multidrop mode’). It looks for addresses with hostname 
parts that match your poll name"

It doesn't appear to (using the second .fetchmailrc with '* here') as it 
forwards *any* mail - maybe the above line means "...addresses with 
hostname parts that match your poll *host*name"?

Finally:

"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)."

Well, I can't get fetchmail to bounce (to the sender) under any 
circumstances.

Does anyone know what I'm doing wrong? How do I get fetchmail to bounce 
mails not addressed to marko or maureeno?

Thanks

Regards,

Mark



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0447-1, 19/11/2004
Tested on: 20/11/2004 20:01:00
avast! - copyright (c) 2000-2004 ALWIL Software.
http://www.avast.com







More information about the Ukfreebsd mailing list