Mail-lib提供的简单发送邮件接口, 这段代码不能在windows下运行
<?php function send_mail($to_address, $from_address, $subject, $message) { $path_to_sendmail = "/usr/lib/sendmail"; $fp = popen( "$path_to_sendmail -t", "w"); $num = fputs($fp, "To: $to_address\n"); $num += fputs($fp, "From: $from_address\n"); $num += fputs($fp, "Subject: $subject\n\n"); $num += fputs($fp, "$message"); pclose($fp); if ($num > 0) { return 1; } else { return 0; } } ?>