系统是linux。php.ini里关于mail那段的配置是:[mail function]
;For Win32 only
SMTP=localhost
smtp_post=25;For Win32 only
;[email protected];For Unix only......
sendmail_path=/usr/sbin/sendmail -t -i(我也没有权利修改这个文件)我写的代码是:$to="[email protected]";//具体邮箱名字我就不写了,这个是公司的邮箱
$subject="hello";
$msg="first email";
$headers="";
$config="-f [email protected]";//同样是公司的邮箱
$email=mail($to,$subject,$msg,$headers,$config);if($email)
{echo "成功";}
else
{echo "失败";}运行这个php文件,等了半天,页面显示“成功”,可是收不到邮件。请问哪里错了?我是新人,不知道自己有没有分给。先谢谢大家。
;For Win32 only
SMTP=localhost
smtp_post=25;For Win32 only
;[email protected];For Unix only......
sendmail_path=/usr/sbin/sendmail -t -i(我也没有权利修改这个文件)我写的代码是:$to="[email protected]";//具体邮箱名字我就不写了,这个是公司的邮箱
$subject="hello";
$msg="first email";
$headers="";
$config="-f [email protected]";//同样是公司的邮箱
$email=mail($to,$subject,$msg,$headers,$config);if($email)
{echo "成功";}
else
{echo "失败";}运行这个php文件,等了半天,页面显示“成功”,可是收不到邮件。请问哪里错了?我是新人,不知道自己有没有分给。先谢谢大家。
mb_language( "Japanese" );
$subject = "=?ISO-2022-JP?B?".base64_encode(mb_convert_encoding( "[随便写]マガジン配信 テストメール: ".$subject, "ISO-2022-JP-MS", "UTF-8" ))."?="; $header = "From: =?ISO-2022-JP?B?" . base64_encode( mb_convert_encoding( $from_name, "ISO-2022-JP-MS", "UTF-8" ) ) . "?=<" . $from_addr . ">\n";
$header .= "MIME-Version: 1.0\n";
$header .="Content-Type: text/html; charset=ISO-2022-JP\n";
$header .="Content-Transfer-Encoding: 7bit\n";
$message = str_replace("\r\n","<br/>",mb_convert_encoding($message,"ISO-2022-JP-MS","UTF-8"));
$reg = '/http:\/\/\S+/';
preg_match_all($reg,$message,$url);
$message = preg_replace($reg,"<a href='".$url[0][0]."'>".$url[0][0]."</a>",$message);
if ( !mail($to_addr,$subject,$message,$header) ) {
return $rtArray['code'] = "false";
} else {
return $rtArray['code'] = "success";
}
}
注意编码。