I had installed Posfix, Dovecot and MySQL on Debian (for example sample.net) and configured its that external users are allowed to send mails only on this domain sample.net (using my SMTP). Also I configured that all mails (like *@sample.net) are forwarded to one mailbox firstname.lastname@example.org. Mostly I was following this guide.
Some my Postfix configuration:
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf mysql-virtual_forwardings.cf query = SELECT destination FROM forwardings WHERE source='%s' Table | SOURCE | destination | | @sample.net | email@example.com |
I’ve allowed my SNTP to receive only mails for sample.net by next way:
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual-transport.cf mysql-virtual-transport.cf query = SELECT transport FROM transport WHERE DOMAIN='%s' Table | DOMAIN | transport | | sample.net | : | | * | error:Only allowing one domain |
All work as I expected but I need add possibility to send mails from local clients (like PHP) to external users. Unfortunately I have no ideas how I can do it.