pierrot10
pierrot10

Reputation: 139

How can I use mail() with redhat, I can't send mail

I am experiencing a problem since a week.... I installed a redhat web server 6 and I upload my file. It work but nor the form. When I want to send a form, I got this error message :

object(SocketException) {
    [protected] _attributes => array()
    [protected] _messageTemplate => ''
    [protected] _responseHeaders => null
    [protected] message => 'Could not send email.'
    [protected] code => (int) 500
    [protected] file => '/var/www/step/lib/Cake/Network/Email/MailTransport.php'
    [protected] line => (int) 76
}

The form use the mail() function of PHP.

I have no idea, what should I configure on my redhat web server to let him send e-mail.

The ports smtp, www, ssh are open

I also install postfix but it did not solve my problem.

Someone know what can I do? Should I installed something and how to configure it?

Many thank for your help in order to use the function mail()

Upvotes: 1

Views: 3349

Answers (2)

Danny
Danny

Reputation: 346

"fatal: chdir /var/spool/postfix: Permission denied" can be solved with:

setsebool -P httpd_can_network_connect 1

See: http://chirale.wordpress.com/2013/04/24/apache-centos-6-cannot-send-email/

Upvotes: 1

Danny
Danny

Reputation: 346

Try FIRST with this mini script and let me know the results:

<?php
$to = "[email protected]";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: [email protected]" . "\r\n" .
"CC: [email protected]";

mail($to,$subject,$txt,$headers);
?>

Upvotes: 0

Related Questions