php - 无法连接到邮件服务器 PHP
问题描述
我刚开始学习 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 脚本
哇.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>
解决方案
推荐阅读
- javafx - 如果值为 0,JavaFX PieChart 隐藏标签
- javascript - 如何通过接受颜色作为 vue js 中的道具来为占位符提供颜色?
- reactjs - 无法访问 docker 内的 beanstalk env 变量以构建反应应用程序
- html - 底部导航栏空白
- javascript - 主题需要 RxJS6 asObservable()?
- c# - 在产品问题(对话框)中单击其他人时唤醒您的功能,它会转到主对话并显示 4 个选项
- python - 如何将一整行更改为列标题?请给我建议
- c# - 编译错误 CS0029 无法将类型“ComboBox.ObjectCollection”隐式转换为“CheckedListBox.ObjectCollection”
- python-3.x - 如何将 PIL 图像从 continius Queue.queue 转换为 numpy 数组?
- vue.js - 添加一行后更新Vue Js表