<HTML>
<HEAD>
<TITLE>mail</TITLE>
</HEAD>
<BODY>
<?
//define who is to receive the mail
$mailTo = "[email protected]"; //set the subject
$mailSubject = "Testing Mail"; //build body of the message
$mailBody = "This is a test of PHP's mail function.";
$mailBody .= "It was generated by PHP version ";
$mailBody .= phpversion(); //add a from header
$mailHeaders = "From: [email protected]\n";
//send mail
mail($mailTo, $mailSubject, $mailBody, $mailHeaders);
?>
</BODY>
</HTML>
你必须保证在配置PHP环境时mail()函数没有被屏蔽!
<HEAD>
<TITLE>mail</TITLE>
</HEAD>
<BODY>
<?
//define who is to receive the mail
$mailTo = "[email protected]"; //set the subject
$mailSubject = "Testing Mail"; //build body of the message
$mailBody = "This is a test of PHP's mail function.";
$mailBody .= "It was generated by PHP version ";
$mailBody .= phpversion(); //add a from header
$mailHeaders = "From: [email protected]\n";
//send mail
mail($mailTo, $mailSubject, $mailBody, $mailHeaders);
?>
</BODY>
</HTML>
你必须保证在配置PHP环境时mail()函数没有被屏蔽!
disable_functions = ; This directive allows you to disable certain改为
disable_functions =mail()
mail()就不能用了!当然,[mail function]
SMTP = localhost ;for win32 only
sendmail_from = [email protected] ;for win32 only
;sendmail_path = ;for unix only, may supply arguments as well (default is 'sendmail -t -i')
也很重要