如何阻止电子邮件客户端自动访问电子邮件中的链接? [英] How to stop e-mail clients from visiting links in e-mail automatically?

查看:285
本文介绍了如何阻止电子邮件客户端自动访问电子邮件中的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP脚本,可以发送纯文本电子邮件,其中包含指向某些操作(如确认和协议等)的链接。

I have a PHP script that sends out plain-text e-mails which contain links to certain actions like confirmations and agreements etc.

我注意到的是Web版本的Outlook将自动检测链接,并在用户单击链接之前在后台访问该链接。我注意到了这一点,因为一旦打开电子邮件,数据库中的内容就会发生变化。
还要检查Apache访问日志,我看到 BingPreview / 1.0b 是用户代理。

What I have noticed is that the Web version of Outlook will automatically detect the link and visit the link in the background before the user clicks on it. I've noticed this because as soon as I open my e-mail, stuff changes in the database. Also checking the Apache access log, I see BingPreview/1.0b as the user agent.

用户可能不想执行这些操作。

This is very bad as the user may not want to perform these actions.

是否可以发送电子邮件标题来禁用此行为?

Are there e-mail headers that I can send to disable this behavior? Suggestions?

推荐答案

正如我在评论中写道:


您可以使用某种形式的输入按钮和一个在条件语句中设置的复选框。无法实际单击/选中它们。

边注更正:我犯了一个轻微的语法错误。内容应为:

Side note correction: I made a slight grammar mistake. That should have read as:


您可以使用某种形式的输入按钮和一个复选框,这些复选框都设置在条件语句中。那些不能实际上被点击/选中,必须由真实的人亲自完成。

"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也建议使用复选框。

Even Google recommends using a checkbox.

  • https://support.google.com/mail/answer/81126?hl=en

在订阅下:


通过手动选中网络上的框形式或在软件中。


默认情况下,在Web表单或软件中设置一个复选框以订阅所有用户(要求用户显式退出邮件)。

另外,您可以使用reCAPTCHA:

Additionally, you could use a reCAPTCHA:

  • https://www.google.com/recaptcha/intro/

有关Google和复选框的另一篇文章;即使与垃圾邮件有关,也适用相同的逻辑:

Here's another article on Google and checkboxes; even though it's "spam-related", the same logic applies:

  • http://blogs.findlaw.com/technologist/2014/12/google-replaces-annoying-anti-spam-captcha-with-checkbox-kittens.html

从该文章中提取:


本周Google推出了一个更好的解决方案: No CAPTCHA reCAPTCHA,我们将其称为复选框和小猫。


就是这样。一个复选框。 我不是机器人。尽管Google并未详细介绍其背后的魔力,但宣布更改的博客帖子说,风险分析引擎衡量用户与页面以及CAPTCHA的交互方式,以判断是否需要除简单的复选框之外的任何其他操作。如果您被检测为人类,则选中一个框并单击提交。

"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."

所有这些都在条件内设置

All this set inside conditional statements to check if a submit button was clicked and the checkbox is set, using name attributes for each.

即:

<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)逻辑运算符。

Sidenote: You could also check if a checkbox is equal to something in addition to the above using the && (AND) logical operator.

示例:&& $ _POST ['checkbox_x'] =='XX'

您也可以在堆栈上查看以下问题与解答:

You could also have look at this Q&A on Stack:

  • Checkbox as alternative to captcha?

在其中建议了蜜罐和其他一些建议。

where a honeypost was suggested and a few other suggestions.

以下内容是从您删除的答案中拉出来的。

The following was pulled from your deleted answer.

参考:

  • http://south634.com/is-hotmail-clicking-your-account-confirmation-links/

您可以做的一件事是,设置您的.htaccess阻止BingPreview用户代理访问您的注册和密码重置路径(您的路径可能与此示例不同)::

RewriteEngine On
RewriteCond %{REQUEST_URI} /signup/confirm/ [OR]
RewriteCond %{REQUEST_URI} /resetting/reset/ 
RewriteCond %{HTTP_USER_AGENT} BingPreview
RewriteRule . - [F,L]

这将阻止BingPreview搜寻器,但我觉得您可以在这里阻止任意数量的烦人的用户代理,但您是否真的想花费所有时间寻找哪些电子邮件提供商在其电子邮件中提供了类似的链接预览?

这篇关于如何阻止电子邮件客户端自动访问电子邮件中的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆