Prevent url's from appearing as links in mail clients

后端 未结 5 377
慢半拍i
慢半拍i 2020-12-17 08:27

I\'m sending an HTML mail from my app, this mail contains URLs, is there a way to prevents from mail clients to show these URLs as links?

for example:



        
相关标签:
5条回答
  • 2020-12-17 09:12

    This is a feature of some mail clients and there's no foolproof way to stop them from doing whatever they want with the message contents.

    You could try to trick the mail clients by wrapping the addresses in empty tags and hope that they aren't smart enough to see through it:

    <td><span>http</span><span>://</span>www.<span>google.</span>com</td>
    
    0 讨论(0)
  • 2020-12-17 09:12

    I'd say that largely depends on the mail client and thus is beyond your control. The only option would be to not make it a URL. E.g. write www.google.com (which the user can copy/paste just like the URL.

    0 讨论(0)
  • 2020-12-17 09:12

    I didn't have any luck in preventing MacMail and Yahoo Mail from creating links out of any text string ending in .com (or other domain extension). After hours of testing (even 'href=""' and 'href="#"' did not work), I finally inserted my own URL and then manipulated the CSS and inline styles to remove the mail clients' link styling.

    0 讨论(0)
  • 2020-12-17 09:20

    I have found the accepted answer doesn't work for Outlook 2013. I have had success with the following:

    http<a href='#' style='text-decoration:none; color:#000;'>://www.google.</a>com
    

    Setting the style cursor:default is not honored by Outlook 2013, but if you only make the middle of the url a hyperlink then a user can still select the link text without the cursor pointer appearing.

    0 讨论(0)
  • 2020-12-17 09:21

    Use a "zero width space" character: &#8203;

    It does as the name implies. It adds a space in your string but the space takes up zero width so instead of looking like two strings, it looks like one.

    0 讨论(0)
提交回复
热议问题