为什么我的HTML在电子邮件中无法正常工作?

时间:2020-09-22 07:13:00

标签: html css email google-apps-script bootstrap-4

我正在使用应用程序脚本并创建HTML模板以将该模板发送到电子邮件。模板如下所示。enter image description here

但是当我通过应用脚本发送它时,它变成了这样:

enter image description here

您可以看到该框丢失了。甚至图标都丢失了。有什么特殊的原因和解决方案吗?

GS代码

var emailTemp = HtmlService.createHtmlOutputFromFile("Approved-email").getContent();
  var mailAddress = sheet.getRange(2,2).getValue();
  
      MailApp.sendEmail(mailAddress,"Leave Status",'',{
        htmlBody:emailTemp
      });

由于某种原因,堆栈溢出不允许我在此处编写HTML代码。

<!DOCTYPE html>
<html>
<head>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<style>

.card {
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    width:300px;
    min-height:400px;
    background:#fff;
    box-shadow:0 20px 50px rgba(0,0,0,.1);
    border-radius:10px;
    transition:0.5s;
    border-style: dotted;
}
.card:hover {
    box-shadow:0 30px 70px rgba(0,0,0,.2);
}
.card .box {
    position:absolute;
    top:50%;
    left:0;
    transform:translateY(-50%);
    text-align:center;
    padding:20px;
    box-sizing:border-box;
    width:100%;
   
}
.card .box .img {
    width:120px;
    height:120px;
    margin:0 auto;
    border-radius:10%;
    overflow:hidden;
    
}
.card .box .img img {
    width:100%;
    height:100%;
}
.card .box h2 {
    font-size:20px;
    color:#262626;
    margin:20px auto;
}
.card .box h2 span {
    font-size:14px;
    background:#e91e63;
    color:#fff;
    display:inline-block;
    padding:4px 10px;
    border-radius:10px;
}
.card .box p {
    color:#262626;
}
.card .box span {
    display:inline-flex;
}
.card .box ul {
    margin:0;
    padding:0;
}
.card .box ul li {
    list-style:none;
    float:left;
}
.card .box ul li a {
    display:block;
    color:#aaa;
    margin:0 10px;
    font-size:20px;
    transition:0.5s;
    text-align:center;
}
.card .box ul li:hover a {
    color:#e91e63;
    transform:rotateY(360deg);
}
</style>



</head>
<body>

<div class="card">
    <div class="box">
        <div class="img">
            <img src="https://i.imgur.com/OWi3x57.gif">
        </div>
        <h2>Hi! John<br><span>Approved</span></h2>
        <p> Details</p>
        <span>
            <ul>
                <li><a href="#"><i class="fa fa-address-card" aria-hidden="true"></i></a></li>
                <li><a href="#"><i class="fa fa-tree" aria-hidden="true"></i></a></li>
                <li><a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a></li>
                <li><a href="#"><i class="fa fa-quora" aria-hidden="true"></i></a></li>
                <li><a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
            </ul>
        </span>
    </div>
</div>

</body>
</html>

谢谢

0 个答案:

没有答案