html - 通过 Sahi Pro 发送时,纯 HTML/CSS 垂直字符不会出现在电子邮件内容中

标签 html css email charts sahi

在我的 100% 功能和响应的自动电子邮件中,我有一个简单的 HTML 表格,它可以 100% 使用以下代码:

'<html lang="en">' +
    '<head>' +
        '<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">' +
    '</head>' +
    '<body>' +
        '<table class="table" style="width: 75%; font-size: 12px; text-align: center; margin-left: 95px; display: block;">' +
        '<thead>' +
            '<tr>' +
            '<th scope="col">ID:</th>' +
            '<th scope="col">Test Status:</th>' +
            '<th scope="col">Project Name / Server:</th>' +
            '<th scope="col">Report Test Description:</th>' +
            '<th scope="col">Browser:</th>' +
            '</tr>' +
        '</thead>' +
        '<tbody>' +
            '<tr>' +
            '<th style="color: #3333ff;">' + IDcounter() + '</th>' +
            $testStatusMessageColor_1 +
            '<td>' + $projName + '</td>' +
            '<td>' + $functions_1 + '</td>' +
            '<td>' + $browserStatus + '</td>' +
            '</tr><tr>' +
            '<th style="color: #3333ff;">' + $IDcounter + '</th>' +
            $testStatusMessageColor_2 +
            '<td>' + $projName + '</td>' +
            '<td>' + $functions_2 + '</td>' +
            '<td>' + $browserStatus + '</td>' +
            '</tr>' +
        '</tbody>' +
        '</table>' +
    '</body>' +
'</html>' +

虽然,当我决定添加另一个显示(例如前面提到的 HTML/CSS 图表图形)时,它根本就没有显示...

代码:

'<html>' +
    '<head>' +
      '<style type="text/css">' +
  'body {font: 13px/1.3 "Lucida Grande",sans-serif; color: #666;}' +
  '.chart {display: table; table-layout: fixed; width: 60%; max-width: 700px; height: 200px; margin: 0 auto; background-image: linear-gradient(to top, rgba(0, 0, 0, 0.1) 2%, rgba(0, 0, 0, 0) 2%); background-size: 100% 50px; background-position: left top;}' +
  '.chart li {position: relative; display: table-cell; vertical-align: bottom; height: 200px;}' +
  '.chart span {margin: 0 1em; display: block; background: rgba(209, 236, 250, 0.75); animation: draw 1s ease-in-out;}' +
  '.chart span:before {position: absolute; left: 0; right: 0; top: 100%; padding: 5px 1em 0; display: block; text-align: center; content: attr(title); word-wrap: break-word;}' +

  '@keyframes draw {0% {height: 0;}}' +
      '</style>' +
    '</head>' +
  '<body>' +
    '<ul class="chart">' +
      '<li>' +
        '<span style="height:100%" title="Column 1"></span>' +
      '</li>' +
      '<li>' +
        '<span style="height:80%" title="Column 2"></span>' +
      '</li>' +
    '</ul>' +
  '</body>' +
'</html>' +

我认为这可能是因为不支持 CSS 语言(因为在浏览器中,图表图形 100% 有效,但在电子邮件正文消息中无效)...我该怎么办?

最佳答案

免责声明:我是 Image-Charts 的创始人。

很遗憾,关键帧无法在电子邮件客户端以及许多过于高级的 css 属性中使用。

要解决此问题,您可能需要使用图表图像。类似于 Image-Charts通过电子邮件发送图表,它是免费的,它适用于所有浏览器和电子邮件客户端并且将是动画的(感谢 gif!)。

https://image-charts.com/chart
    ?cht=p3
    &chs=700x200
    &chd=t:60,40
    &chl=Hello|World
    &chan
    &chf=ps0-0,lg,45,ffeb3b,0.2,f44336,1|ps0-1,lg,45,8bc34a,0.2,009688,1

a

关于html - 通过 Sahi Pro 发送时,纯 HTML/CSS 垂直字符不会出现在电子邮件内容中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53006446/

相关文章:

jquery - 添加覆盖元素背景属性的类

javascript - 灯箱随着任何过渡淡入淡出

email - TFS2015 构建失败的电子邮件通知缺少错误

javascript - 如何使用 jQuery 创建有效的预加载器,它可以将 mp3 文件预加载到浏览器缓存?

php - 'fi' 在数据库中显示不正确

html - 在未嵌套的行之间 Bootstrap 移动元素

.net - MailMessage.IsBodyHtml是做什么的?

html - 如何在运行时将不同大小的 Logo 图像合并到图像标签中

javascript - 如果只有一个错误类,如何选择输入内容

用于捕获相关收件人字段中找到的电子邮件地址的 Javascript 和 PHP 正则表达式