当前位置: 首页 > 知识库问答 >
问题:

从Outlook发送到Gmail的电子邮件链接中删除下划线

吕英才
2023-03-14

我正在努力寻找一个解决方案,从Outlook(Outlook for Office 365)发送到Gmail(桌面版)的电子邮件链接中删除蓝色下划线

生成的html在Google Chrome上运行得很好,但在Gmail上却不行

这是我测试的整个代码:它是用mjml框架生成的:

html lang-html prettyprint-override"><!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

<head>
  <title>
  </title>
  <!--[if !mso]><!-- -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!--<![endif]-->
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style type="text/css">
    #outlook a {
      padding: 0;
    }

    body {
      margin: 0;
      padding: 0;
      -webkit-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
    }

    table,
    td {
      border-collapse: collapse;
      mso-table-lspace: 0pt;
      mso-table-rspace: 0pt;
    }

    img {
      border: 0;
      height: auto;
      line-height: 100%;
      outline: none;
      text-decoration: none;
      -ms-interpolation-mode: bicubic;
    }

    p {
      display: block;
      margin: 13px 0;
    }
  </style>
  <!--[if mso]>
        <xml>
        <o:OfficeDocumentSettings>
          <o:AllowPNG/>
          <o:PixelsPerInch>96</o:PixelsPerInch>
        </o:OfficeDocumentSettings>
        </xml>
        <![endif]-->
  <!--[if lte mso 11]>
        <style type="text/css">
          .mj-outlook-group-fix { width:100% !important; }
        </style>
        <![endif]-->
  <!--[if !mso]><!-->

  <!--<![endif]-->
  <style type="text/css">
    @media only screen and (min-width:480px) {
      .mj-column-per-100 {
        width: 100% !important;
        max-width: 100%;
      }
    }
  </style>
  <style type="text/css">
    <!-- Override Gmail blue links  
    -->
    .ii
    a[href]
    {
    text-decoration:
    none;
    color:
    inherit
     !important;
    }
    .link-nostyle
    {
    color:
    inherit;
    text-decoration:
    none
    }
    .link-underlined
    {
    color:
    inherit;
    text-decoration:
    underline
     !important;
    }
    .link-not-underlined
    {
    color:
    inherit;
    text-decoration:
    none
     !important;
    text-decoration-color:
    transparent;
    color:
    green;
    }
    .myClass,
    .myClass1
    {
    text-decoration:
    none
     !important;
    color:
    orange;
    ;
  </style>
</head>

<body>
  <div style>
    <!--[if mso | IE]>
      <table
         align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
      >
        <tr>
          <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
      <![endif]-->
    <div style="margin:0px auto;max-width:600px;">
      <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
        <tbody>
          <tr>
            <td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;">
              <!--[if mso | IE]>
                  <table role="presentation" border="0" cellpadding="0" cellspacing="0">
                
        <tr>
      
            <td
               class="" style="vertical-align:top;width:600px;"
            >
          <![endif]-->
              <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
                <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:helvetica;font-size:20px;line-height:1;text-align:left;text-decoration:none;color:#F45e46;">Hello <a href="https://mjml.io" class="link-nostyle" style="color: inherit; text-decoration: none;">Hello World</a></div>
                    </td>
                  </tr>
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo odio impedit minus suscipit, quis autem nulla aliquam maxime optio facere, esse quia corrupti possimus expedita aspernatur modi molestiae, iusto dolore. <a style="text-decoration: underline !important; color: orange !important;" href="https://www.google.com"><span style="text-decoration: underline !important; color: red !important;">Test link 2</span></a>
                        <a style="text-decoration: none !important; color: #00d0ff !important;" href="https://www.google.com"><span style="text-decoration: none !important; color: green !important;">Test link 2</span></a></div>
                    </td>
                  </tr>
                  <!-- Link underlined -->
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Hello <a href="https://mjml.io" class="link-underlined" style="color: #f5b33c; text-decoration: underline !important;"><span style="text-decoration: underline !important;">link underlined</span></a></div>
                    </td>
                  </tr>
                  <!-- Link NOT underlined -->
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;text-decoration:none;color:#000000;">Hello <a href="https://mjml.io" class="link-not-underlined">link not underlined</a></div>
                    </td>
                  </tr>
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a style="text-decoration: none !important; color: #00d0ff !important;" href="https://www.google.com"><span style="text-decoration: none !important; color: green !important;">Test link 3</span></a>
                        <br><br> lorem Ipsum <a href="http://www.google.com" target="_blank" style="color: red !important; text-decoration:none !important;">
                          <span style="color:red !important; text-decoration:none!important;">Getting Started with Our Services</span>
                        </a>
                        <br><br>
                        <a href="https://www.google.com" target="_blank" style="color:#CCCCCC; text-decoration:none;">
                          <color="#cccccc">test 4 </color="#cccccc">
                        </a>
                        <div class="myClass"> <a href="mailto:info@example.com">
                            <span class="myClass1">info@ccc.com </span></a> </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Test for numbers: 0711 12345678</div>
                    </td>
                  </tr>
                </table>
              </div>
              <!--[if mso | IE]>
            </td>
          
        </tr>
      
                  </table>
                <![endif]-->
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <!--[if mso | IE]>
          </td>
        </tr>
      </table>
      <![endif]-->
  </div>
</body>

</html>

我尝试了这篇文章的全部建议:如何在从outlook发送电子邮件模板时删除Gmail中的超链接下划线,但没有成功

共有1个答案

云景焕
2023-03-14

所有带有下划线的链接都有一个用于显示下划线的内联css,所以它仍然可见。在某些地方,anchor标记具有span作为带有下划线css的孩子,因此尽管为anchor标记设置了文本装饰:none,但由于span内部的原因,它不起作用。我已经从代码中删除了它,并在下面替换了它。请参阅下面的内容。希望这能解决问题

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

<head>
  <title>
  </title>
  <!--[if !mso]><!-- -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!--<![endif]-->
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style type="text/css">
    #outlook a {
      padding: 0;
    }

    body {
      margin: 0;
      padding: 0;
      -webkit-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
    }

    table,
    td {
      border-collapse: collapse;
      mso-table-lspace: 0pt;
      mso-table-rspace: 0pt;
    }

    img {
      border: 0;
      height: auto;
      line-height: 100%;
      outline: none;
      text-decoration: none;
      -ms-interpolation-mode: bicubic;
    }

    p {
      display: block;
      margin: 13px 0;
    }
  </style>
  <!--[if mso]>
        <xml>
        <o:OfficeDocumentSettings>
          <o:AllowPNG/>
          <o:PixelsPerInch>96</o:PixelsPerInch>
        </o:OfficeDocumentSettings>
        </xml>
        <![endif]-->
  <!--[if lte mso 11]>
        <style type="text/css">
          .mj-outlook-group-fix { width:100% !important; }
        </style>
        <![endif]-->
  <!--[if !mso]><!-->

  <!--<![endif]-->
  <style type="text/css">
    @media only screen and (min-width:480px) {
      .mj-column-per-100 {
        width: 100% !important;
        max-width: 100%;
      }
    }
  </style>
  <style type="text/css">
    <!-- Override Gmail blue links  
    -->
    .ii
    a[href]
    {
    text-decoration:
    none;
    color:
    inherit
     !important;
    }
    .link-nostyle
    {
    color:
    inherit;
    text-decoration:
    none
    }
    .link-underlined
    {
    color:
    inherit;
    text-decoration:
    none
     !important;
    }
    .link-underlined span {
    text-decoration:
    none
     !important;
    }
    .link-not-underlined
    {
    color:
    inherit;
    text-decoration:
    none
     !important;
    text-decoration-color:
    transparent;
    color:
    green;
    }
    .myClass a {
    text-decoration: none;
    }
    .myClass,
    .myClass1
    {
    text-decoration:
    none
     !important;
    color:
    orange;
    ;
  </style>
</head>

<body>
  <div style>
    <!--[if mso | IE]>
      <table
         align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
      >
        <tr>
          <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
      <![endif]-->
    <div style="margin:0px auto;max-width:600px;">
      <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
        <tbody>
          <tr>
            <td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;">
              <!--[if mso | IE]>
                  <table role="presentation" border="0" cellpadding="0" cellspacing="0">
                
        <tr>
      
            <td
               class="" style="vertical-align:top;width:600px;"
            >
          <![endif]-->
              <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
                <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:helvetica;font-size:20px;line-height:1;text-align:left;text-decoration:none;color:#F45e46;">Hello <a href="https://mjml.io" class="link-nostyle" style="color: inherit; text-decoration: none;">Hello World</a></div>
                    </td>
                  </tr>
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo odio impedit minus suscipit, quis autem nulla aliquam maxime optio facere, esse quia corrupti possimus expedita aspernatur modi molestiae, iusto dolore. <a style="text-decoration: none !important; color: orange !important;" href="https://www.google.com"><span style="text-decoration: none !important; color: red !important;">Test link 2</span></a>
                        <a style="text-decoration: none !important; color: #00d0ff !important;" href="https://www.google.com"><span style="text-decoration: none !important; color: green !important;">Test link 2</span></a></div>
                    </td>
                  </tr>
                  <!-- Link underlined -->
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Hello <a href="https://mjml.io" class="link-underlined" style="color: #f5b33c; text-decoration: none !important;"><span style="text-decoration: none !important;">link underlined</span></a></div>
                    </td>
                  </tr>
                  <!-- Link NOT underlined -->
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;text-decoration:none;color:#000000;">Hello <a href="https://mjml.io" class="link-not-underlined">link not underlined</a></div>
                    </td>
                  </tr>
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a style="text-decoration: none !important; color: #00d0ff !important;" href="https://www.google.com"><span style="text-decoration: none !important; color: green !important;">Test link 3</span></a>
                        <br><br> lorem Ipsum <a href="http://www.google.com" target="_blank" style="color: red !important; text-decoration:none !important;">
                          <span style="color:red !important; text-decoration:none!important;">Getting Started with Our Services</span>
                        </a>
                        <br><br>
                        <a href="https://www.google.com" target="_blank" style="color:#CCCCCC; text-decoration:none;">
                          <color="#cccccc">test 4 </color="#cccccc">
                        </a>
                        <div class="myClass"> <a href="mailto:info@example.com">
                            <span class="myClass1">info@ccc.com </span></a> </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                      <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Test for numbers: 0711 12345678</div>
                    </td>
                  </tr>
                </table>
              </div>
              <!--[if mso | IE]>
            </td>
          
        </tr>
      
                  </table>
                <![endif]-->
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <!--[if mso | IE]>
          </td>
        </tr>
      </table>
      <![endif]-->
  </div>
</body>

</html>
 

 类似资料:
  • 问题内容: 我正在尝试使用JavaMail以html格式发送电子邮件,但它似乎始终只在Outlook中显示为文本电子邮件。 这是我的代码: 有什么想法为什么电子邮件的html版本不会在Outlook中显示? 问题答案: 经过大量调查,我已经取得了一些重大进展。 首先,我建议不要使用JavaMail,而应使用Jakarta Commons Email 库。这确实大大简化了问题! 现在的代码是: 讲简

  • 我用竹子来让我的网站访问者填写并发送一份联系表。 我创建了一个服务帐户 我授予它全域权限 我添加了以下范围:https://www.googleapis.com/auth/gmail.addons.current.action.compose https://www.googleapis.com/auth/gmail.addons.current.message.metadatahttps://w

  • 我试图从我的应用程序发送电子邮件,我在android上的电子邮件客户端中看到了应有的链接,但当我检查电子邮件接收器时,没有链接。 这是我的代码: “文本”是html。 谢谢你。

  • 问题内容: 我正在使用。 使用发送电子邮件(通过)的最佳方法是什么? 问题答案: 有关使用Outlook的解决方案,请参见下面的TheoretiCAL答案。 否则,请使用python随附的smtplib。请注意,这将要求您的电子邮件帐户允许smtp,默认情况下不一定启用此功能。 编辑: 此示例使用保留域,如RFC2606中所述 为了使它真正与gmail配合使用,Doe先生需要进入gmail中的选项

  • 我被困在一个公司防火墙后面,它不允许我通过Java Mail API或Apache Commons电子邮件等传统方式发送电子邮件,甚至不允许我发送给公司内部的其他人(无论如何,这就是我想要的)。但我的Outlook 2010显然可以发送这些电子邮件。我想知道是否有办法通过Java代码自动化Outlook 2010,以便Outlook可以发送电子邮件?我知道像“mailto”这样的东西可以用来弹出带

  • 问题内容: 我试图直接在单击按钮时打开Gmail的电子邮件发送表单,但这总是显示用于发送电子邮件的选项列表。 我这样做是为了打开GMail表单: 但这不是打开GMail表单。我应该怎么做才能打开GMail表单,请帮忙。 有什么办法吗? 问题答案: 在线路上使用一些东西