将Mercury Up设置为PHP Mail()函数

时间:2016-08-17 15:20:06

标签: php smtp

我只是在玩一些PHP,我试图成功使用mail()函数。但是,我收到错误:

警告:mail():SMTP服务器响应:550-Verification for 550-No此用户在这里" 550发件人验证失败

我的代码,以防万一有错:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Subscriber List</title>
  <meta name="description" content="The HTML5 Herald">
  <meta name="author" content="SitePoint">
  <link rel="stylesheet" href="test.css">
</head>
<body>
  <?php
  if (empty($_POST['email'])) {
    echo "<form method='POST' action='index.php' name='subscriber'>";
    echo   "Email: <input type='text' name='email'><br>";
    echo   "<button type='submit' name='subscribe'>Subscribe!</button>";
    echo "</form>";
  }

  if (isset($_POST['email'])) {
    $useremail = $_POST['email'];
    $to = 'myemail@workdomain.ca';
    $subject = 'New Subscriber';
    $message = "You have a ne subscriber from $useremail!";
    $headers = "Content-type: text/html\r\n";
    $headers = "From: The Sender Name <from@workdomain.ca>\r\n";

    mail($to, $subject, $message, $headers);
  }
  ?>
</body>
</html>

当我谷歌时,看起来我必须正确设置SMTP服务器。我该怎么做呢?我在水星上使用XAMPP。

0 个答案:

没有答案