azrael_11 0 Posted February 11, 2019 Hello i manage to send an HTML e-mail with formations but i can't add background color to main body. I try this with css but not working // This is for adding repeating image in background of body vHTMLBuild.HtmlFiles.Add(vBackground, 'back.png'); //vHTMLBuild.HtmlFiles.Add(vLogo, 'logo.png'); vHTMLBuild.Html.Add('<html>'); vHTMLBuild.Html.Add('<head>'); vHTMLBuild.Html.Add('<style>body {'+ 'background-image: url("back.png");'+ 'background-repeat: repeat;'+ 'background-color: #cccccc;'+ '}</style>'); vHTMLBuild.Html.Add('</head>'); vHTMLBuild.Html.Add('<body>'); vHTMLBuild.Html.Add('</body>'); vHTMLBuild.Html.Add('</html>'); and this // This is for adding only background color // vHTMLBuild.HtmlFiles.Add(vBackground, 'back.png'); // vHTMLBuild.HtmlFiles.Add(vLogo, 'logo.png'); vHTMLBuild.Html.Add('<html>'); vHTMLBuild.Html.Add('<head>'); vHTMLBuild.Html.Add('<style>body {'+ '{background-color: coral; '}</style>'); vHTMLBuild.Html.Add('</head>'); vHTMLBuild.Html.Add('<body>'); vHTMLBuild.Html.Add('</body>'); vHTMLBuild.Html.Add('</html>'); Thank you. Share this post Link to post
Remy Lebeau 1393 Posted February 11, 2019 That has nothing to do with Indy, and everything to do with your particular HTML/CSS, and whether the receiver supports what you are trying (for instance, not all email readers support background images - see The Ultimate Guide to Background Images in Email ). Indy does not care about the particular content of your HTML, it gets sent as-is (other than to encode it for transmission purposes only). I will say this, though: - in your 1st case, 'url("back,png")' is wrong for an embedded image, you need to use 'url("cid:back.png")' instead since "back.png" is the Content-ID you assigned to the attachment. - in your 2nd case, the 3rd call to Html.Add() appears to be broken. 2 Share this post Link to post
azrael_11 0 Posted February 12, 2019 12 hours ago, Remy Lebeau said: That has nothing to do with Indy, and everything to do with your particular HTML/CSS, and whether the receiver supports what you are trying (for instance, not all email readers support background images - see The Ultimate Guide to Background Images in Email ). Indy does not care about the particular content of your HTML, it gets sent as-is (other than to encode it for transmission purposes only). I will say this, though: - in your 1st case, 'url("back,png")' is wrong for an embedded image, you need to use 'url("cid:back.png")' instead since "back.png" is the Content-ID you assigned to the attachment. - in your 2nd case, the 3rd call to Html.Add() appears to be broken. Remy this is a hell good Guide, it helps a lot. In the 1st your are right i miss that. In the 2nd case i forgot some " '+" so yes it is broken. Thank you. Share this post Link to post