On Tue, Jan 06, 2026 at 03:49:23PM +0100, Sidney Cadot wrote: > Hmm. If I send a mail to [email protected], I see the same behavior. > And the "sidney" user exists.
Isn't the test server hercules.wherewithal.nl rather than wherewithal.nl? If so, why would it see [email protected] as a local user? > If what you suggest is correct, it raises the question: how does smtpd make > the determination if the mail is intended for a local user? MDA is a term for a program that does local delivery. You are telling smtpd that you want to deliver to a local user by using the mda option in your config file. Traditionally, local users were actual user accounts on the system. These days there are various ways to create aliases or do other processing so that there is no longer necessarily a one to one relationship between system user accounts and local mail users. > > The fact that you are doing your own custom processing of the message > > using a > > script which doesn't actually deliver the mail anywhere doesn't alter the > > fact > > that smtpd wants to 'deliver' it to a valid user. > > > > But as far as smtpd is concerned, my configured mda /does/ succeed in > delivering mail. It returns with exitcode 0, and I think that's all that > smtpd cares about. Your script is not even being run when smtpd reports the 550 invalid recipient error. > My problem at this stage is that the mail coming in from port 2525 from > outside doesn't ever reach my mda.py script. Exactly. Because the local user does not exist, smtpd does not run your script. > It's not explicitly mentioned in the smtpd manual pages, but in general > > 'mda' > > is a term for a program that does _local delivery_, so the name basically > > imples that you can't use it as a general mail handling mechanism. > > > > I don't intend to do that. My mda.py script is mostly a debugging aid, to > see what is going on and to understand what kind of information is being > passed around. So you do intend to do that. A debugging script to show what is going on but which doesn't deliver mail is not a mail delivery program in the traditional sense. It's doing other processing of the mail it's receiving, (or not, in this case). > > Just set up a simple, normal mail delivery configuration, and get that > > working first. Then look inside it using logs, debug options, and then > > maybe > > some custom scripts to do non-standard things with received mail. > > > > Well, different people learn in different ways. I want to build a > close-to-correct mental model of what happens to mails as they pass through > smtpd, and I've hit a stumbling block where an incoming mail is not entered > into the queue, with no obvious clue in the documentation as to why that > happens. Since you're having such basic problems right at the beginning, my advice remains to approach this in a different way. It's easier to learn from a setup that's working correctly than one that's compltely broken. > The man page of smtpd.comf has the following description of the behavior > when a message : > > When mail arrives, each ???RCPT TO:??? command generates a mail > envelope. If an envelope matches any of a pre-designated set of criteria > (using the match di??? > rective), the message is accepted for delivery. A copy of the > message, as well as its associated envelopes, is saved in the mail queue > and later dispatched > according to an associated set of actions (using the action > directive). The key part here is "according to a set of actions", you are asking smtpd to do something it cannot do - pass the message to a program capable of delivering it to a local user _which does not exist as far as smtpd is concerned_. > My smtpd.conf has: > > match from any action "my-test-mda" > > The behavior I see can be explained in two ways: > > * The match test is never done; the message is rejected even before that. > (However, this scenario seems to contradict the behavior described in the > man page). > * The match test is done, but it fails; and thus the message is rejected. > (This scenario begs the question how the "from any" test could fail) > > Which of these two explanations is correct? Neither. > Or is there another explanation > still? Yes, you are telling smtpd to deliver to a local user which does not exist. Since it cannot do that, your 'delivery' program is never run.
