如何知道HTTP请求来自哪个电子邮件客户端? [英] How to know from which email client the HTTP request was coming from?
问题描述
可能重复:
电子邮件客户端检测
Possible Duplicate:
Email client detection
我有一个新闻通讯,其中有一个指向我的网站页面的链接.现在,我想知道用户在哪个电子邮件客户端(gmail,hotmail,Outlook)中打开了新闻通讯,并单击了指向网站页面的链接.
I have a newsletter which will have a link to my websites pages. Now i want to know which email client (gmail, hotmail, outlook) the user opened the newsletter in and clicked the link to the website page.
我想知道哪个电子邮件客户端,是因为我想根据用户对电子邮件客户端的使用来自定义网站页面中的内容.
The reason I want to know which email client, is because i want to customize the content in website pages based on the use of email client by users.
我的网站页面将用PHP编码
My Website pages will be coded in PHP
推荐答案
查看User-Agent标头($ _SERVER ['HTTP_USER_AGENT']).
Look at the User-Agent header ($_SERVER['HTTP_USER_AGENT']).
对于使用网络邮件的用户,用户代理将是其浏览器的代理.因此您也可以查看Referer标头($ _SERVER ['HTTP_REFERER']). (但是请注意,浏览器不会从https站点发送引用标头.)
For users using webmails, the user-agent will be that of their browser; so you could look at the Referer header ($_SERVER['HTTP_REFERER']) too. (But notice that browsers don't send referer headers from https sites.)
这篇关于如何知道HTTP请求来自哪个电子邮件客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!