php mail()
阿新 • • 發佈:2018-11-24
http overflow sendmail cti dmi oca his end php.ini
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 ="[email protected]" ;sendmail_from="[email protected]";
$to = "[email protected]";
$subject = "this is a subject";
$message = "haha ,this is a letter .";
$header = "From:[email protected]";
$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
php mail()