Html 如何阻止 Outlook 将电子邮件地址呈现为 mailto: 链接?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2110825/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I stop Outlook from rendering an email address as a mailto: link?
提问by Josh Kodroff
I am creating an HTML email to be sent to a user. If there is a valid email address to within an HTML email, Outlook will render it (normally helpfully) as a mailto: link. Unfortunately, that's not the desired behavior in the particular email I'm sending.
我正在创建要发送给用户的 HTML 电子邮件。如果 HTML 电子邮件中有一个有效的电子邮件地址,Outlook 会将它(通常很有帮助)呈现为一个 mailto: 链接。不幸的是,这不是我发送的特定电子邮件中所需的行为。
How do I stop Outlook from doing this?
如何阻止 Outlook 执行此操作?
回答by hallundb?k
Outlook doesn't recognize this pattern as an email: @[text]@[text].[text]
Outlook 无法将此模式识别为电子邮件: @[text]@[text].[text]
Thus adding before the email:
因此在电子邮件之前添加:
<a style="color: black; text-decoration: none"><font style="display: none">@</font>**email**</a>
and
和
<style>font {display: none}</style>
in the <head>
tag will remove the mailto link.
在<head>
标签中将删除 mailto 链接。
回答by Elbelcho
I found your question through google, and hours later I found an answer that works for me for the same problem.
我通过谷歌找到了你的问题,几个小时后我找到了一个对我同样问题有用的答案。
Wrap the email address inside an href with "#" as the target, and set the color to black and text decoration to none. Additionally, put the email address in another font tag, inside the anchor, with font size and type as well.
用“#”作为目标将电子邮件地址包裹在一个 href 中,并将颜色设置为黑色,将文本装饰设置为无。此外,将电子邮件地址放在锚点内的另一个字体标签中,并带有字体大小和类型。
Like this:
像这样:
<font face="Arial, Helvetica, sans-serif" size="1" color="#CCCCCC">
This e-mail was sent to
<a href="#" style="color:#CCCCCC; text-decoration:none;">
<font face="Arial, Helvetica, sans-serif" size="1" color="#CCCCCC">
[email]</font></a>.</font>
The result is that the email address becomes a clickable link, but 1) it doesn't look like a clickable link and 2) the link doesn't go anywhere nor does it attempt to perform a mailto:
结果是电子邮件地址变成了一个可点击的链接,但 1) 它看起来不像一个可点击的链接 2) 该链接不会去任何地方,也不会尝试执行 mailto:
It's not perfect, but it's good enough for me for now.
它并不完美,但对我来说已经足够了。
回答by Vineeth R
Navigate to Tools > Options > Mail Format > Editor Options
Click on Proofing
Click on Auto Correct Options
Click on Auto Format tab and uncheck 'Internet and Networks path with hyperlinks'
Clikc on Auto Format as You Type and uncheck 'Internet and Networks path with hyperlinks'
Save and changes
导航到工具 > 选项 > 邮件格式 > 编辑器选项
单击校对
单击自动更正选项
单击自动格式选项卡并取消选中“带有超链接的 Internet 和网络路径”
单击“键入时自动格式化”并取消选中“带有超链接的 Internet 和网络路径” '
保存并更改
(This solution is for Outlook 2007)
(此解决方案适用于 Outlook 2007)
回答by Libby
After trying all the valid solutions here, I came up with one on my own. For various reasons, none of the others worked, because I am required to achieve this result on all email clients, not just Outlook.
在尝试了所有有效的解决方案之后,我自己想出了一个。由于各种原因,其他人都没有工作,因为我需要在所有电子邮件客户端上实现此结果,而不仅仅是 Outlook。
I added an invisible image spacer before and after the @ symbol as well as before the 'com'.
我在@ 符号前后以及“com”之前添加了一个不可见的图像间隔。
to
到
writehere<img class="nullsp" alt="" border="0" height="0" src="/spacer.gif" style="display:none; visibility: hidden; font-size: 0px; line-height: 0px" width="0"/>@<img class="nullsp" alt="" border="0" height="0" src="/spacer.gif" style="display:none; visibility: hidden; font-size: 0px; line-height: 0px" width="0"/>example.<img class="nullsp" alt="" border="0" height="0" src="/spacer.gif" style="display:none; visibility: hidden; font-size: 0px; line-height: 0px" width="0"/>com
Additionally I added a class (and this could be directed toward mobile):
此外,我添加了一个类(这可以针对移动设备):
img[class="nullsp"] { height:0px !important; width:0px !important; display:none !important; visibility: hidden !important;}
This fixed the issue in all email clients including gmail, yahoo and aol. The only issue is in outlook a tiny space is visible where the images would be, and if you copy and paste the address into a text editor, spaces appear.
这解决了所有电子邮件客户端(包括 gmail、yahoo 和 aol)中的问题。唯一的问题是在 Outlook 中,图像所在的位置可以看到很小的空间,如果您将地址复制并粘贴到文本编辑器中,则会出现空格。
A test in EOA shows this to work on most client/browser combinations that I tested: Safari, IE9, Chrome, Firefox; Gmail, Yahoo, AOL, MSN; Outlook, Android4. According to EOA, it still linked in Apple Mail6 and iPad2 and Iphone5 and 6; however on my own iPhone5 it did not link. And EOA is not famous for its accuracy.
EOA 中的一项测试表明,这适用于我测试过的大多数客户端/浏览器组合:Safari、IE9、Chrome、Firefox;Gmail、雅虎、AOL、MSN;展望,Android4。根据EOA,它仍然链接在Apple Mail6和iPad2以及Iphone5和6中;但是在我自己的 iPhone5 上它没有链接。而 EOA 并不以其准确性而闻名。
I would appreciate anyone who could respond with a similar solution to the 4 devices I listed which failed.
我将不胜感激任何可以对我列出的 4 个失败设备提供类似解决方案的人。
~Libby
~利比
回答by rosell.dk
Here is a solution which does not prevent emails from being turned into links, but it allows you to set the font color and remove the underline of that link.
这是一个解决方案,它不会阻止电子邮件被转换为链接,但它允许您设置字体颜色并删除该链接的下划线。
It works in all email clients I tested in on litmus.com - including Outlook 2010, 2013, 2016 (also on Windows), Outlook.com, iPhone 6s, iPad, gmail web interface and Apple Mail 8, 9
它适用于我在 litmus.com 上测试过的所有电子邮件客户端 - 包括 Outlook 2010、2013、2016(也在 Windows 上)、Outlook.com、iPhone 6s、iPad、gmail Web 界面和 Apple Mail 8、9
Variation 1: A link which does not react when clicked upon
变化 1:点击时没有反应的链接
<a href="#" style="text-decoration:none; color:#000">[email protected]</a>
Variation 2: A mailto-link. Works in almost all clients. Outlook.com does however style it blue and with underline.
变体 2:mailto-link。适用于几乎所有客户端。然而,Outlook.com 确实将其样式设置为蓝色并带有下划线。
<a href="mailto:[email protected]" style="text-decoration:none; color:#000">[email protected]</a>
The @-hack offered by hallundb?k does not work on iPhone,iPad or gmail. And in gmail, the extra @ is displayed, which is not so cool.
Hallundb?k 提供的@-hack 不适用于 iPhone、iPad 或 gmail。而在gmail中,额外显示了@,这不是那么酷。
The solution proposed by elbelcho is very similar to variation 1, but has additional font-tags, which turns out not to be neccessary.
elbelcho 提出的解决方案与变体 1 非常相似,但有额外的字体标签,这不是必需的。
回答by jyfa
I did it like this:
我是这样做的:
<span>username<span "display: none;">@</span>@mail.com<span>
The parser was not able anymore to identify the e-mail and didn't add the "mailto" hyperlink.
解析器无法再识别电子邮件并且没有添加“mailto”超链接。
回答by Joe Phillips
Can you put it in a <pre>[email protected]</pre>
tag?
你能把它放在<pre>[email protected]</pre>
标签里吗?
回答by Morfildur
As far as i know there is no way to do it, but you could try writing the email in a way that outlook does not recognize (i.e. try replacing the @ by it's &# unicode representation).
据我所知,没有办法做到这一点,但您可以尝试以 Outlook 无法识别的方式编写电子邮件(即尝试将 @ 替换为 unicode 表示)。
I'm no outlook expert and i never had this particular problem so i would be interested in an easier way, too.
我不是 Outlook 专家,我从来没有遇到过这个特殊问题,所以我也会对更简单的方法感兴趣。
回答by Marty Schleiff
I have a similar desire to include URLs in email messages that are NOT rendered as links. I'm trying to discourage users from clicking links in email as a security measure, but I haven't yet found a way to tell them what to type (or cut-and-paste) into their browser without the information being rendered as a link. I think it would be OK to just leave off the "http : //"; however, my URLs tend to be https.
我也有类似的愿望,希望在电子邮件中包含不呈现为链接的 URL。作为一种安全措施,我试图阻止用户点击电子邮件中的链接,但我还没有找到一种方法来告诉他们在不将信息呈现为关联。我认为可以省略“http://”;但是,我的 URL 往往是 https。
回答by Peter Jacoby
There is no way to do this. Outlook uses a text parser to look at the incoming email and if it finds something that matches its definition of an e-mail address (my guess is that it would be something like [text]@[text].[text]) then it adds a mailto: hyperlink on it.
没有办法做到这一点。Outlook 使用文本解析器来查看传入的电子邮件,如果它找到与电子邮件地址定义相匹配的内容(我的猜测是它类似于 [text]@[text].[text]),那么它添加一个 mailto: 超链接。
This has nothing to do with the format you sent your mail in (text, RTF, or HTML). It also varies on the version of Outlook because it seems that Outlook 2007 is "smarter" at figuring out hyperlinks (both mailto and http) than 2003 is.
这与您发送邮件的格式(文本、RTF 或 HTML)无关。它也因 Outlook 版本而异,因为与 2003 相比,Outlook 2007 在找出超链接(mailto 和 http)方面似乎“更聪明”。
If you don't want the address to display as a link then I recommend either adding spaces to the text:
如果您不希望地址显示为链接,那么我建议您在文本中添加空格:
name @ company.com
or changing the @ sign to something that a human would understand but which Outlook would ignore:
或者将 @ 符号更改为人类可以理解但 Outlook 会忽略的内容:
name[AT]company.com
Or just tell your recipients not to click on it and see if they follow directions :)
或者只是告诉你的收件人不要点击它,看看他们是否按照指示:)