Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
How Do I Connect PHP Email Script to Postfix?
I have a VPS where I’ve installed my site files, including the PHP email script that uses the php mail() function inside of the following directory (how my site directory/path is set up):
And when I installed Postfix, I’ve configured it to send email through Amazon SES. Postfix has been installed inside of the following directory:
The problem that I’m having is that it will send email from the command line when testing that Postfix has properly installed along with using the Amazon SES SMTP, BUT my php email script DOESN’T connect from my websites folder directory to Postfix.
How do I connect my php email script to Postfix? Do I need to change directories?
Here is the php mail() function script that I’m using below:
<?php $to = "MyTestEmailAddress@gmail.com"; $subject = "Another Test!"; $txt = "Hello world!"; $headers = "From: MyEmailAddress@gmail.com" . "\r\n" . "CC: AnotherTestEmailAddress.com"; mail($to,$subject,$txt,$headers); ?>
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×