在WAMP中使用php通过电子邮件确认密码

时间:2013-03-05 04:27:26

标签: php mysqli wamp

在登录时,用户的详细信息将被带入数据库,但不会发送任何电子邮件来激活帐户。它显示以下错误: 完成:

( ! ) Warning: mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to mailserver at &quot;mail.YourDomain.com&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set() in C:\wamp\www\form\index2.php on line 61
Call Stack
#   Time    Memory  Function    Location
1   0.0006  385856  {main}( )   ..\index2.php:0
2   0.0078  398648  mail ( )    ..\index2.php:61
Thank you for registering! A confirmation email has been sent to divschari@gmail.com Please click on the Activation Link to Activate your account

激活帐户的代码是:

    if (mysqli_affected_rows($dbc) == 1) { //If the Insert Query was successfull.

                // Send the email:
                $message = " To activate your account, please click on this link:\n\n";
                $message .=WEBSITE_URL .'activate.php?email='. urlencode($Email) . "&key=$activation";

                mail($Email, 'Registration Confirmation', $message, 'From:'.EMAIL);

                // Flush the buffered output.

                // Finish the page:
                echo '<div class="success">Thank you for
registering! A confirmation email
has been sent to ' . $Email .
                    ' Please click on the Activation Link to Activate your account </div>';

            } else { // If it did not run OK.
                echo '<div class="errormsgbox">You could not be registered due to a system
error. We apologize for any
inconvenience.</div>';
            }

        } else { // The email address is not available.
            echo '<div class="errormsgbox" >That email
address has already been registered.
</div>';
        }

对php.ini进行了更改,但代码中的错误仍然存​​在。

0 个答案:

没有答案