我有一个 PHP 脚本,它发送纯文本电子邮件,其中包含指向某些操作(如确认和协议(protocol)等)的链接。
我注意到的是,Web 版本的 Outlook 会在用户点击链接之前自动检测该链接并在后台访问该链接。我注意到了这一点,因为一旦我打开电子邮件,数据库中的内容就会发生变化。
同时检查Apache访问日志,我看到 BingPreview/1.0b 作为用户代理。
这是非常糟糕的,因为用户可能不想执行这些操作。
是否可以发送电子邮件标题来禁用此行为?建议?
最佳答案
正如我在评论中所写:
"You could use some form of input button and a checkbox all set in conditional statements. Those can't physically be clicked/checked."
旁注更正:我犯了一个轻微的语法错误。那应该读作:
"You could use some form of input button and a checkbox all set in conditional statements. Those can't virtually be clicked/checked, and must be physically done by a real person."
甚至 Google 也建议使用复选框。
在“订阅”下:
"By manually checking a box on a web form, or within a piece of software."
和
"Setting a checkbox on a web form or within a piece of software to subscribe all users by default (requiring users to explicitly opt-out of mailings)."
此外,您可以使用 reCAPTCHA:
这是关于 Google 和复选框的另一篇文章;即使它是“垃圾邮件相关的”,同样的逻辑也适用:
摘自那篇文章:
"Google introduced a better solution this week: the "No CAPTCHA reCAPTCHA," which we'll refer to as "checkboxes and kittens."
和
"That's it. A checkbox. "I'm not a robot." Though Google doesn't go into detail on the magic behind the box, the blog post announcing the change said that a "risk analysis engine" measures how a user interacts with a page, and with the CAPTCHA, to tell if anything more than a simple checkbox is necessary. If you're detected as a human, you check a box and hit submit."
所有这些都在条件语句中设置,以检查是否单击了提交按钮并设置了复选框,使用每个的名称属性。
IE。:
<form action="handler.php" method="post">
<input type="checkbox" value="XX" name="checkbox_x">
<input type="submit" name="submit_button">
</form>
<?php
if(isset($_POST['submit_button'])){
if(isset($_POST['checkbox_x'])){
// Do your thing
// Additionally, you could place GET array(s) if they're being used
// and also check to see if any are set and not empty.
}
}
?>
旁注:您还可以使用
&&
(AND) logical operator 检查复选框是否与上述内容相同。 .示例:
&& $_POST['checkbox_x'] == 'XX'
.您还可以查看 Stack 上的这个问答:
建议使用蜜站和其他一些建议。
以下内容摘自您已删除的答案。
引用:
“您可以做的一件事是,设置 .htaccess 以阻止 BingPreview 用户代理访问您的注册和密码重置路径(您的路径可能与此示例不同)::
RewriteEngine On
RewriteCond %{REQUEST_URI} /signup/confirm/ [OR]
RewriteCond %{REQUEST_URI} /resetting/reset/
RewriteCond %{HTTP_USER_AGENT} BingPreview
RewriteRule . - [F,L]
“这会阻止 BingPreview 爬虫,但我觉得这是一个不完整的解决方案。你可以在这里屏蔽尽可能多的烦人的用户代理,但你真的想花所有的时间来寻找哪些电子邮件提供商提供了类似的链接吗?在他们的电子邮件中预览?”
关于php - 如何阻止电子邮件客户端自动访问电子邮件中的链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43443947/