PHP发送电子邮件不起作用

时间:2013-06-18 03:24:19

标签: php html ini sendmail.exe

我正在尝试测试此发送邮件表单,我的php.ini配置如下:

SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = myemail@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t "

sendmail.ini:

 account default : Gmail account Gmail tls on tls_certcheck off host smtp.gmail.com    from email@gmail.com auth on user email@gmail.com password port 587

当我测试页面时,我没有错误,所以我认为它正在工作,但我根本没有收到任何消息,甚至在我的垃圾邮件箱中也没有。发生了什么,我错过了什么?

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail("myemail@gmail.com", $subject,
  $message, "From:" . $email);
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='testm.php'>
  Email: <input name='email' type='text'><br>
  Subject: <input name='subject' type='text'><br>
  Message:<br>
  <textarea name='message' rows='15' cols='40'>
  </textarea><br>
  <input type='submit'>
  </form>";
  }
?>

</body>
</html>

0 个答案:

没有答案