在Outlook中的电子邮件链接的PHP问题
问题描述:
我想做一个PHP脚本,向用户发送确认电子邮件,包括必须单击的链接,以便激活用户帐户。在Outlook中的电子邮件链接的PHP问题
已经过测试,可以正常工作,例如gmail电子邮件帐户。
$message = "Confirm your email.
Click the link below to confirm your account.
https://testonly.000webhostapp.com/web_emailconfirm.php?user_name=$user_name&confirm_code=$confirmCode";
mail($email,"Confirmation email",$message,"From: [email protected]");
一旦在电子邮件中的链接被点击,它会打开内部运行的核查另一个PHP脚本的网站,用户数据库被一些新的值更新。
的问题是:它似乎像,在Outlook,只需打开电子邮件似乎是触发的链接,因为PHP代码运行和用户的数据库进行更新,其实之前单击链接。
这是怎么回事?
答
尝试改变
$message = "Confirm your email.
Click the link below to confirm your account.
https://testonly.000webhostapp.com/web_emailconfirm.php?user_name=$user_name&confirm_code=$confirmCode";
到
$message = "Confirm your email.
Click the link below to confirm your account.
<a href='https://testonly.000webhostapp.com/web_emailconfirm.php?user_name=$user_name&confirm_code=$confirmCode'>https://testonly.000webhostapp.com/web_emailconfirm.php?user_name=$user_name&confirm_code=$confirmCode</a>";
UPDATE
你也应该沿着HTML邮件标题传递
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
您可以了解更多
+0
检查示例3链接我提供 –
+0
谢谢,我会看看,并测试你的答案 – codeKiller
链接是否故意不在锚标签中? –
对于我的“新手”无知感到抱歉...你在'锚标记'中意味着什么?我拿了从另一个地方发送电子邮件的代码,它的工作原理如此...... – codeKiller
Click Here to verify –