I have a server that is meant to deliver emails from PHP but not receive any emails. My domain MX records point to a different mail service and I have Postfix configured to not handle any FQDN emails. I'd like to send any local emails (postmaster errors, cronjob notices, etc.) to a single external email address firstname.lastname@example.org.
I've found a couple different questions on here that attempt to solve this (here and here most notably), but they seem to redirect all outbound emails as well, for example email@example.com and firstname.lastname@example.org get delivered to email@example.com too.
One solution that does seem to work would be writing out virtual aliases for @localhost, @localhost.localdomain, and @cookweb1 separately to firstname.lastname@example.org, but surely there's a more elegant, generic solution? Here is the relevant part of my /etc/postfix/main.cf (erroneously forwards ALL mail to email@example.com):
myhostname = cookweb1 alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = cookweb1, localhost.localdomain, localhost relayhost = mynetworks = loopback-only mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = loopback-only virtual_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual-regexp
/etc/postfix/virtual is empty. Here is /etc/postfix/virtual-regexp (both have postmaps generated):