【问题标题】:Verification e-mail not sent未发送验证电子邮件
【发布时间】:2010-12-20 15:57:33
【问题描述】:

嘿,我已经设置了下面的一段代码来向订阅者发送验证电子邮件。但它似乎没有到达他们(我自己测试它)我正在使用http://localhost/ 来测试该站点,不知道这是否是问题所在。此外,我收到了验证电子邮件已发送的消息,因此应该发送。代码如下:

if(mysql_query("insert into users(username,password,email,fname,lname,hash) values('$username','$password','$email','$fname','$lname','$hash')")or die (mysql_error ())){
 echo "Welcome, You have successfully signed up. Please check the verification e-mail sent to you.";
 $to = $email; 
   $subject = 'Signup | Verification'; 
   $message = ' 

     Thanks for signing up! 
      Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. 

      ------------------------ 
      Username: '.$username.' 
     Password: '.$password.' 
     ------------------------ 

     Please click this link to activate your account: 

     http://www.JMtoday.com/verify.php?email='.$email.'&hash='.$hash.' 

   ';

    $headers = 'From:noreply@JMtoday.com' . "\r\n";  
    mail($to, $subject, $message, $headers); 
 }

【问题讨论】:

  • 我的用户名将是 ', '', '', '', '', '');截断表用户;--

标签: php


【解决方案1】:

除非您也在 localhost 上运行邮件服务器,否则mail 函数将不知道将电子邮件发送到哪里。

【讨论】:

  • 谢谢,我是新手,所以我不知道。
  • 一年后...这样的东西可以帮助测试 localhost 电子邮件:smtp4dev.codeplex.com 在测试邮件功能时让它在后台运行。
猜你喜欢
  • 2019-03-05
  • 2023-03-28
  • 2019-06-24
  • 2018-11-21
  • 2019-03-04
  • 1970-01-01
  • 2016-09-08
  • 1970-01-01
  • 2018-09-09
相关资源
最近更新 更多