为什么无法发送邮件?

php code:

  <?php
$to = '[email protected]';
$subject = $_POST["s"];
$message = $_POST["m"];
$headers = "From:" . $_POST["f"];
if(mail($to, $subject, $message, $headers)){
    echo "发送成功";
} else {
    echo "发送失败";
}
?>

html code:

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
    <form action="https://file.hqrcode.top/data/upload/file/20240411/b1e04d63a1b5bef393c169b624c0f706.php">
       <input placeholder="你的名称" name='f[]'/>
       <br/>
       <input placeholder='标题' name='s[]'/>
       <br/>
       <textarea name='m[]' placeholder='邮件正文'></textarea>
       <br/>
       <input type="submit" value='发送邮件'/>
    </form>
</body>
</html>

<b>测试</b>

直接这么发送邮件是不行的,你需要一个 SMTP 服务器哈