I using Google app script for sending email but I can't set background image before sending email.
I tried jquery and css for set background image but not working
Thank you
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
<?!= include("style");?>
</head>
<style>
*{
}
body {
background-image: url('cid:https://miyagen8.co.jp/wp-content/uploads/2021/11/background.png');
}
</style>
<body>
<div >
<p> <?= client.company ?> </p>
<p> <?= client.department ?> </p>
<p> <?= client.derector ?> </p>
<p> <?= client.name ?>様 </p>
<p>いつもお世話になります。</p>
<p>Text body</p>
</div>
</body>
</html>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>
CodePudding user response:
From the official document, I had thought that background-image
might be able to be used. So, for example, in your situation, when background-image
is included in the tag of body
as the inline style, is that the result you expect?
From:
<body>
To:
<body style="background-image: url('https://miyagen8.co.jp/wp-content/uploads/2021/11/background.png')">
Reference:
CodePudding user response:
Check out this for an example. From what I can tell this is not a valid link: cid:https://miyagen8.co.jp/wp-content/uploads/2021/11/background.png
because you are setting two protocolls cid
and https
. Therefore remove the cid:
and it should work with this:
https://miyagen8.co.jp/wp-content/uploads/2021/11/background.png