php mail()

First:
open the php.ini
and find the keyword mail function

[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
SMTP = smtp.163.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from ="admin@wampserver.invalid"
;sendmail_from="xxx@163.com";
$to = "xxx@qq.com";
$subject = "this is a subject";
$message = "haha ,this is a letter .";
$header = "From:xxx@163.com";
$retval = mail($to,$subject,$message,$header);
if($retval){
	echo "successful";
}else{
	echo "fail";
}

Reference:
https://stackoverflow.com/questions/5335273/how-to-send-an-email-using-php

Note:
mail() will not work in local server.
ozzz

原文地址:https://www.cnblogs.com/cyany/p/10012227.html