我是 php 新手,所以请多多包涵。我已经为我正在创建的测试网站创建了一个注册。该网站收集用户信息,然后发送确认电子邮件。到目前为止,经过多次尝试,还没有收到任何电子邮件。我已经尝试过垃圾邮件文件夹,但无济于事。
这是我的代码:
$to = "$email";
// Change this to your site admin email
$from = "someperson@gmail.com";
$subject = "Complete your registration";
//Begin HTML Email Message where you need to change the activation URL inside
$message = '<html>
<body bgcolor="#FFFFFF">
Hi ' . $username . ',
<br /><br />
You must complete this step to activate your account with us.
<br /><br />
Please click here to activate now >>
<a href="http://testw.freevar.com/activation.php?id=' . $id . '">
ACTIVATE NOW</a>
<br /><br />
Your Login Data is as follows:
<br /><br />
E-mail Address: ' . $email . ' <br />
Password: ' . $password . '
<br /><br />
Thanks!
</body>
</html>';
// end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$to = "$to";
// Finally send the activation email to the member
mail($to, $subject, $message, $headers,-f $from);
提前致谢!
PS 我已经在网上阅读了关于 php.ini 文件夹的信息。我正在从头开始创建一个网站,但不知道这是什么或是否有必要。另外,我正在使用没有电子邮件地址的免费托管服务。我不确定这是否会影响它。