Today I will show you how to configure Postfix (PHP mail) to work with domain having extenal MX records. E.g. Suppose you are working on website http://www.example.com, Now you have configured Google MX records on domain.
Now if you will use PHP mail function to send any email to [email protected], Will not work. To allow PHP mail function to work with domain having extenal MX records, we will have to configure postfix.
Postifx disable local delivery or Configure Postfix to use external MX servers for delivery of local mail if user is unknown
To achive this, We will need to edit postfix configuration file. i.e. main.cf. In most of the servers it exists in /etc/postfix/main.cf.
Open this file in vim or nano editor. e.g.
Now find the line contain “my_destination”. You will have to remove domain name from “my_destination” values like below i have “example.com”.
Now restart the postfix using following command.