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):
/var/www/mywebsite.com/html/
https://ibb.co/XF1JFvv
And when I installed Postfix, I’ve configured it to send email through Amazon SES. Postfix has been installed inside of the following directory:
/etc/postfix/
https://ibb.co/2SDjb8z
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);
?>
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello, @AaronEsteban1
The code itself looks good, have you checked the PHP error_log for further troubleshooting as well? You can find the exact location of the error_Log by checking the php.ini file. If there are any errors they should be logged in the log.
Let me know how this goes.
Regards, Alex
if you created the script under Windows or OSX, edit further it under Unix:
sed -i -e 's/\r$//' email_script.php
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.