Gmail 正在修剪 html 电子邮件内容。如何避免这个问题?

发布于 2025-01-08 08:41:59 字数 682 浏览 0 评论 0原文

Gmail 在电子邮件中引入了修剪功能,以“提高可读性”。这给我带来了很多痛苦,因为我有一个电子邮件通知系统,我可以在其中向用户发送一些 html 电子邮件消息。电子邮件基本上如下所示:

divs and styling
Object alert in Project by User
tables and tr/td
User Action on Object in Project
/tables and tr/td
/divs and styling

link
footer

要将所有电子邮件分组到一个对话中,第一封电子邮件有主题,后续电子邮件有回复:主题。

活跃用户可以收到大量此类电子邮件,但由于“更好的可读性”功能,所有电子邮件内容(从第二封电子邮件开始)都会被抑制。

我正在寻求建议 - 也许我应该重新设计我的 html,或者 gmail 有一些反抑制代码,或者只是解决这个问题的 hack。

从用户角度描述的问题如下:http:// /www.google.com/support/forum/p/gmail/thread?tid=756b83fa60ca1df7&hl=zh-CN

Gmail introduced a trimming feature in emails for "better readability". This causes a lot of pain for me, as I have a notification system for email, where I send some html email messages to users. Basically email looks like this:

divs and styling
Object alert in Project by User
tables and tr/td
User Action on Object in Project
/tables and tr/td
/divs and styling

link
footer

To group all emails in one conversation, first email has subject, subsequent emails have Re: subject.

Active users can receive significant amounts of emails like this, but due to "better readability" feature, ALL of the email content (starting from second email) is suppressed.

I am looking for advice - maybe I should redesign my html, or gmail has some anti-suppression code, or just a hack to go around this issue.

Issue from users perspective is described here: http://www.google.com/support/forum/p/gmail/thread?tid=756b83fa60ca1df7&hl=en

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

假装爱人 2025-01-15 08:41:59

我在 HTML 时事通讯的表格上出现了修剪问题。
整个表格的显示非常重要,因为它是
#1 我们的客户想要沟通的内容。这是解决方法,或者至少是我们解决问题的方法。 我们消除了任何重复。
因此,对于这张表,每行之间的线,Gmail 看到的是
行视为重复。所以我将像素宽度每隔 1 像素更改一次
线,消除了重复并解决了我们的问题。以便
说,寻找重复,并尝试删除它。或者在某些情况下,您
可能需要添加文字(白色)来创建变体。

来源

PS:这有点无关,但我在寻找一种禁用内容修剪并同时保持对话视图的方法时偶然发现了这个问题。我没有找到任何东西,所以我为 Chrome 开发了一个小扩展程序火狐

I had the trimming problem occurring on a table of an HTML newsletter.
It was very important that the entire table display because it was the
#1 content our client wanted to communicate. Here's the fix, or at least here's how we solved our problem. We eliminated any repetition.
So for this table, the lines in between each row, Gmail was seeing the
lines as repetitive. So I altered the pixel width by 1 px every other
line, which eliminated the repetition and fixed our problem. So that
said, look for repetition, and try to remove it. OR in some cases, you
might have to add type (in white) to create the variation.

Source.

PS: This is a bit unrelated, but I stumbled upon this question while looking for a way to disable the content trimming and keep the conversation view at the same time. I didn't find anything, so I developed a small extension for Chrome and Firefox.

咿呀咿呀哟 2025-01-15 08:41:59

事实证明,有一个非常简单的规则导致了这种行为:Gmail 一旦在邮件正文中看到发件人(发件人:)名称,就会立即剪辑该电子邮件,无论该邮件位于何处出现。

解决方案:确保邮件正文中未使用电子邮件中的发件人:姓名(签名除外,签名可能会被剪掉!)。

It turns out that there is a very simple rule which causes this behaviour: Gmail will clip the email as soon as it sees the sender (From:) name in the body of the message, regardless of where this appears.

Solution: make sure that that the From: name in your email is not used in the message body (except in the signature, which will probably get clipped!).

戏剧牡丹亭 2025-01-15 08:41:59

如果您不幸中招的话,这就是 Gmail 中的一个可怕的错误

就我而言,它是在一个干净的线程中“修剪”整个消息。 在此处查看示例,请注意“修剪”的内容在屏幕截图中展开。

我最终解决了 Gmail 的错误,删除了您在该示例中看到的整个标头(“Awesome Home Swap”),包括其下方的边框。我没有真正尝试弄清楚到底是什么让 Gmail 将该标头混淆为“签名”(尽管我怀疑它可能是边框,使用 CSS 指令 border-bottom 实现:1px 点状灰色 来设置 元素的样式)。

This is an awful bug in Gmail, if you're unlucky enough to get bitten by it.

In my case, it was "trimming" an entire message, in a clean thread. See an example here, noting that the "trimmed" content is expanded in the screen-shot.

I ultimately worked around Gmail's bug by removing the entire header you see in that example ("Awesome Home Swap"), including the border below it. I stopped short of actually trying to figure out what specifically was making Gmail confuse that header as a "signature" (though I suspect it could have been the border, implemented using CSS directive border-bottom:1px dotted grey to style the <td> element).

花开柳相依 2025-01-15 08:41:59

我刚刚找到了一个对我来说非常有效的解决方案。只需在整个电子邮件中创建一堆隐藏的独特图像,即可为电子邮件中实际上并不独特的部分提供独特性。我正在使用 React 构建电子邮件,因此我有这个Unique组件,我几乎在任何地方都使用它:

import * as React from "react"

function random() {
    return Math.round(Math.random() * 10000000).toString()
}

class Unique extends React.PureComponent {

    render() {
        return (
            <img style={Unique.style} src={`data:image/png;base64,${random()}`} />
        )
    }


    static style = {
        visibility: "hidden",
        display: "none",
        width: 0,
        height: 0,
        color: "transparent",
        background: "transparent",
    }
}

我喜欢这个解决方案的一件事是它不会弄乱电子邮件预览文本如果您使用隐藏文本,则会发生这种情况。

I just found a solution that worked wonderfully for me. Simply create a bunch of hidden unique images throughout your emails to provide uniqueness to parts of the email that aren't actually unique. I'm building my emails with React so I have this Unique components that I'm using pretty much everywhere:

import * as React from "react"

function random() {
    return Math.round(Math.random() * 10000000).toString()
}

class Unique extends React.PureComponent {

    render() {
        return (
            <img style={Unique.style} src={`data:image/png;base64,${random()}`} />
        )
    }


    static style = {
        visibility: "hidden",
        display: "none",
        width: 0,
        height: 0,
        color: "transparent",
        background: "transparent",
    }
}

One thing I like about this solution is that it doesn't mess up the email preview text that would otherwise happen if you're using hidden text.

枯寂 2025-01-15 08:41:59

在折叠部分之前添加双连字符 -- 。我能够将其包装在字体颜色与背景相匹配的字体中。为我工作...

Add a double hyphen -- before the collapsed part. I was able to wrap it in a with font color matching the background. Worked for me...

国粹 2025-01-15 08:41:59

我查看了 Gmail 发送的电子邮件。添加以下代码 (spacer.gif)。

我想这就是解决方案。

            <img alt="" height="1" width="3" src="https://notifications.google.com/g/img/AD-FnEztup4OClDshQhMVXDbi6Oi0lSN-FgEY1jyW384aotccA.gif">
        </td>
    </tr>
</table>
</body>
</html>

I looked at the emails Gmail sent. Adds the following code (spacer.gif).

I guess this is the solution.

            <img alt="" height="1" width="3" src="https://notifications.google.com/g/img/AD-FnEztup4OClDshQhMVXDbi6Oi0lSN-FgEY1jyW384aotccA.gif">
        </td>
    </tr>
</table>
</body>
</html>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文