Please do not mark this as a duplicate issue. I have tried the recommended steps (checking error logs, checking syntax, header info.. etc..) to troubleshoot which the mod has pointed me to and all those steps did not work. I am receiving a PERMISSION issue and I can not seem to figure out why. The error I get is:
"Nov 13 14:19:08 centos64 sendmail[6611]: uADJJ80J006611: SYSERR(nginx): queueup: cannot create queue file ./qfuADJJ80J006611, euid=498, fd=-1, fp=0x0: Permission denied ~"
Original Message:
Would like some help with sending email using PHP on a nginx centOS 6.4 server. I am new to this so want to first verify if my current setup is correct and diagnose what the exact issue is before I start tweaking config files.
Goal: I would like to be able to send all the users in my SQL database email alerts, etc.. So eventually if I have a large user-base I could be sending a lot of emails..
In my php.ini file I see..
sendmail_path = /usr/sbin/sendmail -t -i
And I have used command
/etc/init.d/postfix status
to verify that postfix is installed and is also up to date (yum -y install postfix, or whatever it was)
I was looking at this helpful thread ( http://www.webhostingtalk.com/showthread.php?t=1238442 ) and also looking to follow this guide ( http://www.server-world.info/en/note?os=CentOS_6&p=mail ) but again, didnt want to start messing with stuff until I had guidance.
I tried to send mail using the following code, and simply visited the email.php page on my server and did not get my test email. The test email was attempted to be sent from and to a gmail email address.
<?php $to = 'GMAIL_EMAIL@gmail.com';
$subject = 'Testing';
$message = 'Hello';
$headers = 'From: GMAIL_EMAIL@gmail.com' . "\r\n" .
'Reply-To: GMAIL_EMAIL@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
As usual, any and all help is appreciated. Thanks!
SOLUTION:
- I used commands
sudo setsebool -P httpd_can_sendmail 1
sudo setsebool -P httpd_can_network_connect 1
And then the messages were sitting in the clientmqueue folder not being sent, so I looked at the /var/log/maillog and saw a message that said.. 'centos64 postfix/smtp[22..7]: connect to gmail-smtp-in.l.google.com[....]:25: Network is unreachable' so I googled the error message and read that I needed to do install of cyrus plain..
yum install cyrus-sasl-plain
Hope this helps someone else out there in the same boat.