标准方式来检测移动邮件客户端? [英] Standard way to detect mobile mail client?

查看:133
本文介绍了标准方式来检测移动邮件客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题类似于标准方式来检测基于http请求的Web应用程序中的移动浏览器除了邮件客户端。例如,如果在内置的iPhone邮件客户端上打开电子邮件,它将显示特别为iPhone格式化的邮件版本。如果在平板电脑或桌面上打开,它将显示为完整的电子邮件的完整尺寸版本。这在原理上类似于网站的移动友好版本,通过检测用户代理自动加载 - 但对于电子邮件客户端。

This question is similar to "Standard way to detect mobile browsers in a web application based on the http request" except for mail clients. For instance, if an email message is opened on the built-in iPhone mail client it will display a version of the message specially formatted for the iPhone. If opened on an tablet or desktop it will display as the complete, full-size version of the email. This is similar in principle to web sites that have mobile-friendly versions of the site that load automatically by detecting the user-agent - but for email clients.

可以检测用于打开电子邮件并相应地格式化邮件的邮件客户端?

So - is it possible to detect the mail client being used to open an email and format the message accordingly? Perhaps a way to detect the screen resolution?

推荐答案

您可以尝试应用 @media css查询定位特定浏览器(如移动设备)。在 campaignmonitor帮助网站上有一个很好的介绍,但请注意,它可能只在手中支持充满了浏览器和设备,iOS幸运:)

You can try to apply @media css queries that target specific browsers like mobile devices. There is a good introduction on the campaignmonitor help website but be aware, it probably is only supported in a hand full of browsers and devices, iOS being on of them luckily :)

基本上你是定义css样式,目标特定的屏幕宽度,以便你可以优化您的电子邮件有限的屏幕空格。

Basically you are defining css styles that target specific screen widths so that you can optimize your email for limited screen space.

@media only screen and (max-device-width: 480px) { ... }

当谈论真正的检测和显示完全不同的电子邮件时,这真的不可能,因为你在谈论javascript,电子邮件,甚至可能不会在所有电子邮件客户端的99%工作。但是你可以用@media查询一个无聊的方式。

When talking really detection and displaying a totally different email, that's really impossible since you are talking about javascript there and that's not done in emails and probably won't even work in 99% of all email clients. But you can go a loooong way with @media queries.

这篇关于标准方式来检测移动邮件客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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