Php 如何将mail()与redhat一起使用,我可以';不要发邮件
我一个星期以来遇到了一个问题。。。。 我安装了redhat web服务器6,并上传了我的文件。它起作用,但形式也不起作用。 当我要发送表单时,收到以下错误消息:Php 如何将mail()与redhat一起使用,我可以';不要发邮件,php,email,sendmail,redhat,postfix-mta,Php,Email,Sendmail,Redhat,Postfix Mta,我一个星期以来遇到了一个问题。。。。 我安装了redhat web服务器6,并上传了我的文件。它起作用,但形式也不起作用。 当我要发送表单时,收到以下错误消息: object(SocketException) { [protected] _attributes => array() [protected] _messageTemplate => '' [protected] _responseHeaders => null [protected]
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
}
表单使用PHP的mail()函数
我不知道,我应该在我的redhat web服务器上配置什么来让他发送电子邮件
smtp、www、ssh端口已打开
我也安装了postfix,但它并没有解决我的问题
有人知道我能做什么吗?
我应该安装一些东西吗?如何配置它
非常感谢您的帮助,以便使用函数mail()首先尝试使用此小脚本,并告诉我结果:
<?php
$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com" . "\r\n" .
"CC: somebodyelse@example.com";
mail($to,$subject,$txt,$headers);
?>
“致命:chdir/var/spool/postfix:权限被拒绝”可以通过以下方法解决:
setsebool-p httpd_can_network_connect 1
请参阅:您好,不幸的是,它也能正常工作。没有收到收件人的邮件$to有我的私人电子邮件,cc有我的教授电子邮件。还没有收到任何电子邮件。使用unbuntu,我通过安装postfix解决了这个问题,但在redhat上,它并没有解决任何问题。我认为解决方案不是postfix,但我真的不确定服务器上是否存在PHP PEAR,否则请安装它:[root@localhost~]#yum安装php-pear并使用pear安装php邮件扩展:[root@localhost~]#安装邮件并重新启动Apache服务你好,我也这么做了#yum安装php pear,然后#pear安装Mail,但它并没有解决我的问题如果你用我的脚本发送邮件,你能告诉我错误行吗?是的,我已经这样解决了我的问题。你提供解决方案的速度比我快。Cheershttpd\u可以发送邮件-->打开