邮件发送不成功,提示:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in E:\wwwroot\study_php\fun.php on line 110
failedphp发邮件类代码如下:class MailSend {
var $body;
var $to;
var $header;
var $object;
function MailSend($_to, $_object, $_body) {
$this->body = $_body;
$this->object = $_object;
$this->to = $_to;
}
function send() {
//$this->setheader();
if (mail ( $this->to, $this->object, $this->body )) {
echo "Succeed";
} else {
echo "failed";
}
}
}
调用代码:<?php
require_once("fun.php");
$mailSend=new MailSend("[email protected]","first","Just for try");
$mailSend->send();
?>php.ini配置如下:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25; For Win32 only.
sendmail_from = me@localhost高手快来看看是什么问题?
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in E:\wwwroot\study_php\fun.php on line 110
failedphp发邮件类代码如下:class MailSend {
var $body;
var $to;
var $header;
var $object;
function MailSend($_to, $_object, $_body) {
$this->body = $_body;
$this->object = $_object;
$this->to = $_to;
}
function send() {
//$this->setheader();
if (mail ( $this->to, $this->object, $this->body )) {
echo "Succeed";
} else {
echo "failed";
}
}
}
调用代码:<?php
require_once("fun.php");
$mailSend=new MailSend("[email protected]","first","Just for try");
$mailSend->send();
?>php.ini配置如下:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25; For Win32 only.
sendmail_from = me@localhost高手快来看看是什么问题?
解决方案 »
- php 已经把页面成功抓取到,但是查看源代码内容,有些内容却不显示
- switch和 if..else哪个快?
- 求租:数组累加
- 求PHP在一个页面做增删改查的例子,帮帮忙,新手
- PHP Startup: Unable to load dynamic library ,不知道为啥在FC9出这样的问题。
- SQL语句的问题
- 有没有较简单的PHP加解密函数?主要是不想让参数在URL中明文显示
- ★ 大哥们使过:PHP Expert Editor 吗?请教如何配置!谢谢!
- 怎么样才能在php中判断用户非正常离开网站.
- 求大神帮忙小童鞋,初学者遇到问题求帮忙解决
- 一个DIV+CSS的中国地图
- PHP输出XML,内容里的< > 怎么办?
var $body;
var $to;
var $header;
var $object;
function MailSend($_to, $_object, $_body) {
$this->body = $_body;
$this->object = $_object;
$this->to = $_to;
}
function send() {
$this->MailSend( xx, xx, xx );
if ( mail ( $this->to, $this->object, $this->body ) ) { // 感觉还是少了个参数
echo "Succeed";
} else {
echo "failed";
}
}
}
ini_set('sendmail_from', '[email protected]');
比如mail函数的第五个参数要加 [email protected],
SPF记录要在DNS上设好:
my.domain.com. IN TXT "v=spf1 +ip4:xxx.xxx.xxx.xxx ~all"