这是我找到解决此问题的解决方案。1. 在 wamp 目录的某处创建sendmail.php文件,例如 d:\wamp\apps\sendmail.php。这是它的来源:
/* Path where emails will be stored */
define('DST', 'd:/wamp/tmp/sendmail/');
/* Extract the message from the stdin */
$message = '';
while(($line = fgets(STDIN)) !== false) {
$message .= $line;
}
/* Save message to file */
file_put_contents(DST.date('Y-m-d_H-i-s_').md5($message).'.eml', $message);
2. 取消注释并将php.ini中的sendmail_path参数编辑为:
sendmail_path = "D:\wamp\bin\php\php5.3.5\php.exe D:\wamp\apps\sendmail.php"
通过 mail() 函数发送的所有消息都将被捕获并存储在指定的目录中。