On Sun, Jan 29, 2023 at 09:32:47PM +0000, Sean Hennessey wrote: > What I'm looking for is the envelope recipient. I need a way to force > an unqualified to address to a domain I can blackhole. I've got an > application that feeds into these systems that will allow its users to > enter badly formed email addresses. What I want to do is to just > swallow those in postfix. What I was attempting to do, was get the > envelope to to be forced to @blackhole.local, and then I just discard > that w/ a transport map. > > Is there a way to accomplish that?
Yes: master.cf: smtp inet n - n - - smtpd -o { append_at_myorigin = yes } -o { rewrite_service_name = bh-rewrite } -o { cleanup_service_name = bh-rewrite } ... cleanup unix n - n - 0 cleanup bh-cleanup unix n - n - 0 cleanup -o { append_at_myorigin = yes } -o { rewrite_service_name = bh-rewrite } ... rewrite unix - - n - - trivial-rewrite bh-rewrite unix - - n - - trivial-rewrite -o { myorigin = blackhole.invalid } This will affect all unqualified addresses that come in via the SMTP service in question. All other sources remain unchanged. You could even use some sort of NAT rules to direct incoming SMTP traffic from just the problem clients to the custom SMTP service on an alternate IP:port. -- Viktor.