我刚刚开始学习PHP,并正在尝试使用mail()函数。我使用XAMPP服务器运行脚本,并且具有将值通过电子邮件发送给我的形式。但是,一旦提交表单并将其重定向到我的php文件,我会收到一个错误
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\Php files\woah\woah.php on line 13
这是我的HTML和PHP脚本
woah.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form method="POST" action="woah.php">
<label for="Typed1">Type 1</label>
<input type="text" name="Typed1"><br>
<label for="Typed2">Type 2</label>
<input type="text" name="Typed2"><br>
<label for="submit">Submit form</label>
<input type="submit" name="submit">
</form>
</body>
</html>
来自woah.php
<html>
<head>
<title>Yooo php</title>
</head>
<body>
<?php
$Type1=$_POST['Typed1'];
$Type2=$_POST['Typed2'];
$to='experimenting.Logan@gmail.com';
$Message='Yo you typed '.$Type1. ' and also '. $Type2;
mail($to,' ',$Message,'From: Yes');
?>
</body>
</html>