wamp配置sendmail发送邮件

下载 sendmail ( 地址: http://www.glob.com.au/sendmail/sendmail.zip )

【PHP.ini 配置】

[mail function]
; For Win32 only.
SMTP = smtp.163.com

; For Win32 only.
sendmail_from = sample@163.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path ="D:\wamp\sendmail\sendmail.exe -t"//注意是反斜杠

 

【endmail.ini 配置】

smtp_server=smtp.163.com

smtp_port=25

smtp_ssl=auto

error_logfile=error.log

debug_logfile=debug.log

auth_username=sample@163.com
auth_password=********//即邮箱登陆密码

force_sender=sample@163.com

【测试程序】

1.

<?php
header("Content-type:text/html;charset=GBK");

if(mail("sample@qq.com","测试","测试邮件")){
    echo "发送成功!!";
}else{
    echo "发送失败!!";
}

?>

2.

<?php

$to = "sample@qq.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From: $from";
mail($to,$subject,$message);
echo "Mail Sent.";

?>

【FYI,THX】

 

posted @ 2014-09-19 10:25  Tiago2014  阅读(903)  评论(0编辑  收藏  举报