有没有办法阻止Gmail的"引用文字"隐藏我的电子邮件页脚?

Sea*_*anO 11 html gmail hidden

我向我的用户发送电子邮件,这些用户具有相同的主题,但除了页眉和页脚之外还包含不同的内容.标题包含一个徽标,一个"部分x的n"消息,并且<hr>从不隐藏.页脚包含一个<hr>,相同的"部分x的n"文本和一些我不想隐藏的功能链接(Next,Pause,Tweet).

我试着将这些封装在一起<div id=timestamp>.我也尝试添加&ts=timestamp链接.链接是图像,因此我创建了一个名为image2.png的符号链接,指向image1.png并交替显示这些图像.这些都没有奏效.

有没有我想到的简单解决方案?

这是一些HTML:

names are really separated by, rather than just a comma.</p>
<p>This function does not do any checking for problems. We assume,
in this case, that the input is always correct.</p>
</div>
</div>
<div>
<p>All that remains now is putting the pieces together.</div></div></div></div></span>
<hr>(Part 19 of about 74)<br>
<a href='http://www.mywebapp.com/index.php?action=next'>
<img border=0 src='http://www.mywebapp.com/images/next.png' alt='Get next text'</a>&nbsp;&nbsp;
<a href='http://www.mywebapp.com/index.php?action=pause&listid=252&itemid=2100'>
<img border=0 src='http://www.mywebapp.com/images/pause.png' alt='Pause this text'></a>&nbsp;&nbsp;
<a href='http://twitter.com/home?status=tweetGoesHere'><img border=0 src='http://www.mywebapp.com/images/twitter-a.png' alt='Tweet this'/></a><br>
Original page: <a href='http://eloquentjavascript.net/print.html'>here</a><br>
Run Code Online (Sandbox Code Playgroud)

这是一个截图:

iPhone截图

Sea*_*anO 10

我能够通过<span>在我的电子邮件页脚的每一行附加一个包含唯一不可见字符串的方法来解决这个问题.起初,我刚刚添加time()到每一行,但是一些电子邮件客户端将其解释为电话号码并将字符串转换为URL.所以,我在字符串中预先/后置了一个非数字字符,事情似乎工作得很好.

必须有更好的方法来做到这一点......

  • 正如我所做的那样,您可以创建一个随机数(例如 154385553)并执行此操作 z154385553z。或者,您可以 md5() 您的随机数来创建其哈希值并使用它。 (2认同)

Ada*_*eis 5

在 Gmail 将我的交易电子邮件分解成块并隐藏其中的重复部分后,我发疯了,我在我卑鄙的邮件作曲家中实现了一个受 SeanO 回答启发的辅助功能包中以自动为我添加随机字符串。

默认情况下,此帮助程序<span>在每个</p>标签之前包含一个带有 5 个字符的随机字符串的隐藏。

这是执行此操作的代码片段(Node.js):

const crypto = require('crypto');

//Helper to randomize HTML contents
function randomize(html, tag = '</p>') {

  //Create a 5 char random string for email content to be unique
  const time = String(Date.now());
  const hash = crypto
    .createHash('md5')
    .update(time)
    .digest('hex')
    .substr(0, 5);

  //Create HTML string to replace with and regex
  const str = `<span style="display: none !important;">${hash}</span>${tag}`;
  const regex = new RegExp(tag, 'g');

  //Replace in HTML
  return html.replace(regex, str);
}
Run Code Online (Sandbox Code Playgroud)

不再有破碎的电子邮件!