I realize this is a fetchmail config issue but I was hoping there may be a fetchmail guru here! I have been running a test using fetchmail (6.3.26) on an openSUSE Leap 15.2 server, and get the same with version (6.4.15) on Tumbleweed, to retrieve email from a local email account which takes email for an entire domain as such it is a multidrop mailbox. That account has been sent 5 seperate emails. Three of the emails are to single addresses, one is to two addresses and another is to three addresses. As expected there are 8 separate emails in the local mail spool file from the 5 I sent. As a test I am using the fetchmailrc file:
set postmaster root
poll cumulus protocol POP3 local mydomain.net envelope "X-Original-To:"
username "user" password "pass" to * here fetchall keep
mda "echo 'Hello World - %T - %F'"
The mda is just a dummy to see what is going on when I run it from the command line.
It retrieves all 8 emails correctly identifying the original recipient and %T is substituted correctly for the different email addresses.
Doing “fetchmail -V -f fetchmailrc” confirms that it is running in multidrop mode.
If I substitute ‘myname’ for the ‘*’ (asterisk) in fetchmailrc, fetchmail goes into singledrop mode as you would expect (checked with the -V option) but also retrieves all 8 emails.
I do want to remove duplicates and so want to retrieve just 5 emails from the spool file and have been reading “THE USE AND ABUSE OF MULTIDROP MAILBOXES” on the fetchmailrc man page which says:
Also, note that in multidrop mode duplicate mails are suppressed. A piece of mail is considered duplicate if it has the same message-ID as the message immediately preceding and more than one addressee. Such runs of messages may be generated when copies of a message addressed to multiple users are delivered to a multidrop box.
I have checked that the message-IDs are the same and there are multiple recipients on the ‘To:’ header of the relevant emails. I also have a copy of the spool file if it would help and can trim it to just the relevant headers.
I have not used “fetchmail” in multidrop mode, so I probably can’t actually help here.
However, I’ll point out that “there are multiple recipients on the ‘To:’ header” does not mean much. The “To:” header is not involved in the distribution of email. It is just a line of text within the email.
Typically, the software that originates the email will generate the list of actual recipients (usually called “the envelope”) from the “To:” header. But once the mail is in transit, the “To:” header is not used for anything, other than as a line of text. Who actually gets the email is determined by the “envelope” information which the transit procedures communicate separately from the headers.
Yes the emails are correctly addressed and delivered so I know that the envelope is fine. Postfix seems to use “X-Original-To:” as the header to record that (I believe that there is no real standard, hence it has to be declared in the config file) on an individual mail basis which is what fetchmail uses. The fetchmail documentation talks about “a message addressed to multiple users” and I think that could only be determined by parsing the “To:” header.
OK, I am now talking to the fetchmail people. It’s not a configuration issue with my fetchmailrc but rather a bit of a mismatch between the documentation and the actual functionality. Consider this closed.