On Tue, Feb 15, 2022 at 12:26:55PM -0600, [email protected] wrote:
> I have a server configured to accept mail for the domain of the server
> itself (example.org) and virtual domains (example.com). The virtual
> domain has several mappings of users to both local mbox accounts and
> remote forwarding. That works correctly.
> 
> The problems I'm having are:
> 
> 1. When I send mail to non-existent users in vusers from the local
> machine, no bounce message is ever sent back to the user. I do see the
> following log entries, but is there a way to configure bounce messages
> sent back to the client in this case?
> 
> Feb 15 12:15:09 server smtpd[90604]: 886047b20afc9b3d smtp
> disconnected reason=quit
> Feb 15 12:15:22 server smtpd[90604]: 886047b5d8ac59a6 smtp connected
> address=local host=server.example.org
> Feb 15 12:15:22 server smtpd[90604]: 886047b5d8ac59a6 smtp
> failed-command command="RCPT TO:<[email protected]> "
> result="524 5.2.4 Mailing list expansion problem:
> <[email protected]>"
> Feb 15 12:15:22 server smtpd[90604]: 886047b5d8ac59a6 smtp
> disconnected reason=disconnect

Your mail server is not accepting the mail because of the invalid
recipient. Not having accepted the incoming mail, your mail server did
not assume responsibility for transferring it to the recipient. There
is, therefore, no reason for a bounce message. Further, it would be
actively harmful to have such functionality, because anyone poking
your server could trigger it to send bounces to any real or imaginary
addresses.

> 
> 
> 2. Even when sending from a local account to a local non-existent user
> such as [email protected], I don't get a bounce as I'd
> expect.
> 
> Feb 15 12:18:05 server smtpd[90604]: 886047b616b4564e smtp connected
> address=local host=server.example.org
> Feb 15 12:18:05 server smtpd[90604]: 886047b616b4564e smtp
> failed-command command="RCPT TO:<[email protected]> "
> result="550 Invalid recipient: <[email protected]>"
> Feb 15 12:18:05 lax smtpd[90604]: 886047b616b4564e smtp disconnected
> reason=disconnect

Again, why do you expect a bounce? As the SMTP client, you got a clear
error message "invalid recipient" and the transaction was aborted.

> 
> 
> 3. When sending mail to non-existent users from an external mail
> server, I get the same log message generated and a 524 error is sent
> back to the sender with "Mailing list expansion problem" as the
> message.
> 
> Is there a way to generate a standard 550 Invalid recipient message,
> instead?

You can put something like this in your smtpd.conf(5) to reject
invalid recipients up front with a message of your choosing:

filter validuser phase rcpt-to match !rcpt-to <vuser> \
    reject "550 5.1.1 Mailbox does not exist"

and then include that filter in the chain for the exchanger listener.

HTH,
Tom

> 
> 
> Configurations are below; thank you very much in advance for assistance.
> 
> # uname -a
> OpenBSD server 7.0 GENERIC#5 amd64
> 
> # hostname
> server.example.org
> 
> # cat /etc/mail/vdoms
> example.com
> 
> # cat /etc/mail/vusers
> [email protected]     [email protected]
> [email protected]    jane
> 
> # cat /etc/mail/smtpd.conf
> ###### smtpd.conf
> listen on em0 hostname server.example.org
> listen on lo0
> table aliases db:/etc/mail/aliases.db
> table vusers file:/etc/mail/vusers
> table vdoms file:/etc/mail/vdoms
> #
> action "local" mbox alias <aliases>
> action "receive" mbox virtual <vusers>
> action "outbound" relay
> #
> match for local action "local"
> match from any for domain example.org action "local"
> match from any for domain <vdoms> action "receive"
> match from local for any action "outbound"
> 

Reply via email to