> Strangely it does work if I send mail to "john...@example.com"

This, I think, is the smoking gun. When you send mail to yourself, it matches 
the "accept for local" rule rather than the "accept from any for domain" rule, 
so the expansion is based on "alias <aliases>" rather than "virtual <aliases>".

My stab in the dark for why johnsm...@example.net->johnsm...@example.net works 
is that the server believes its mailname is example.com, so example.net does 
not match the local rule.

For debugging these types of configurations, it's often quite illuminating to 
trace expand and lookup (smtpd -F -T expand -T lookup).

Hope this helps.


On 2/27/20 12:47 PM, Erik Harmon wrote:
> I have set up a new instance of OpenSMTPD 6.0.3-portable (the packaged 
> version on Ubuntu 18.04) servicing the same end user on two domains, with two 
> inboxes. The problem arises when I try to send an email to myself 
> "johnsm...@example.com" to "johnsm...@example.com". I get an Invalid 
> Recipient error. I have included my configuration below:
> # cert valid for both domains
> pki example.com certificate "/etc/letsencrypt/live/example.com/fullchain.pem"
> pki example.com key "/etc/letsencrypt/live/example.com/privkey.pem"
> listen on eth0 tls pki example.com mask-source
> listen on eth0 port 587 tls-require pki example.com auth mask-source
> listen on lo port 10029 tag dkim mask-source
> table aliases { "johnsm...@example.com" => johncom, "johnsm...@example.net" 
> => johnnet }
> table domains { "example.com", "example.net" }
> accept for local alias <aliases> deliver to lmtp "/var/run/dovecot/lmtp"
> accept from any for domain <domains> virtual <aliases> deliver to lmtp 
> "/var/run/dovecot/lmtp"
> accept tagged ! dkim for any relay via smtp://
> accept tagged dkim for any relay pki example.com
> Strangely it does work if I send mail to "john...@example.com". Sending from 
> example.com to example.net also works. sending from example.net to 
> example.com does not work, "Invalid Recipient". Sending from example.net to 
> example.net works. It appears only the first domain has a problem where mail 
> from either account can't be sent to the first one.
> What am I doing wrong?
> Regards,
> Erik

Reply via email to