Note that there are some explanatory texts on larger screens.

plurals
  1. POTable not inheriting css to email Html Template in Console Application
    primarykey
    data
    text
    <p>I have a Html Template in Console Application i have to send mails using this template everything works fine but css is not applied in this template i have written css on the same html page I know I Can use properties of table Like bgcolor and all property In Table But this is not a Solution.....</p> <p>my Code for html template is </p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Mail Alert For Tenders&lt;/title&gt; &lt;style media="screen" type="text/css"&gt; .Table { margin: 1px 1px 1px 1px; width: 600px; -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; } .Table table { width: 100%; height: 100%; margin: 0; padding: 0; border-collapse: collapse; border-spacing: 0; } .Table tr:last-child td:last-child { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; } .Table table tr:first-child td:first-child { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; } .Table table tr:first-child td:last-child { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; } .Table tr:last-child td:first-child { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; } .Table tr:nth-child(odd) { background: -o-linear-gradient(bottom, #4da28f 5%, #56998a 100%); background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4da28f), color-stop(1, #56998a) ); background: -moz-linear-gradient( center top, #4da28f 5%, #56998a 100% ); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#4da28f", endColorstr="#56998a"); background: -o-linear-gradient(top,#4da28f,#56998a); background-color: #4da28f; /*border:0 dashed #000000;*/ text-align: justify; border-width: 0 0 1px 1px; font-family: Arial; font-weight: bold; color: #ffffff; } .Table tr:nth-child(even) { background: -o-linear-gradient(bottom, white 5%, #e5e5e5 100%); background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, white), color-stop(1, #e5e5e5) ); background: -moz-linear-gradient( center top, #ff7f00 5%, white 100% ); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="white", endColorstr="#e5e5e5"); background: -o-linear-gradient(top,white,FFFFCC); background-color: white; text-align: justify; border-width: 0 0 1px 1px; font-family: Arial; font-weight: bold; color: black; } .Table td { vertical-align: middle; border-width: 0 1px 1px 0; text-align: left; padding: 1em 3px 30px 5px; font-size: 12px; font-family: Arial; font-weight: 600; } .Table tr:last-child td { border-width: 0 1px 0 0; } .Table tr td:last-child { border-width: 0 0 1px 0; } .Table tr:last-child td:last-child { border-width: 0 0 0 0; } .Table tr:first-child td:first-child { border-width: 0 0 1px 0; } .Table tr:first-child td:last-child { border-width: 0 0 1px 1px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="Table"&gt; &lt;table&gt; &lt;tr&gt; &lt;td width="15%"&gt; Tender Title &lt;/td&gt; &lt;td colspan="3" width="85%"&gt; {TenderTitle} &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="15%"&gt; Tender ID &lt;/td&gt; &lt;td width="35%"&gt; {TenderID} &lt;/td&gt; &lt;td width="15%"&gt; Tender Type &lt;/td&gt; &lt;td width="35%"&gt; {TenderType} &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="15%"&gt; Tender Value &lt;/td&gt; &lt;td width="35%"&gt; {TenderValue} &lt;/td&gt; &lt;td width="15%"&gt; Tender EMD &lt;/td&gt; &lt;td width="35%"&gt; {TenderEMD} &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="15%"&gt; Location &lt;/td&gt; &lt;td width="35%"&gt; {Location} &lt;/td&gt; &lt;td width="15%"&gt; Organization Name &lt;/td&gt; &lt;td width="35%"&gt; {OrgName} &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="15%"&gt; Last Date &lt;/td&gt; &lt;td width="35%"&gt; {LastDateForSubmission} &lt;/td&gt; &lt;td width="15%"&gt; Category &lt;/td&gt; &lt;td width="35%"&gt; {SubProductCatName} &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p> </p> <p>and to send mail I have used this code</p> <pre><code>using (var sReader = new StreamReader(TemplatePath)) { var htmlTemplate = sReader.ReadToEnd(); htmlTemplate = htmlTemplate.Replace("{TenderTitle}", tender.TenderTitle); htmlTemplate = htmlTemplate.Replace("{TenderID}", tender.TenderID.ToString("N1")); htmlTemplate = htmlTemplate.Replace("{TenderType}", tender.TenderTypeName); htmlTemplate = htmlTemplate.Replace("{TenderValue}", tender.TenderValue.ToString("Rs. ##,###")); htmlTemplate = htmlTemplate.Replace("{TenderEMD}", tender.TenderEMD); htmlTemplate = htmlTemplate.Replace("{Location}", tender.Location); htmlTemplate = htmlTemplate.Replace("{OrgName}", tender.OrgName); htmlTemplate = htmlTemplate.Replace("{LastDateForSubmission}", tender.LastDateForSubmission.ToString("yyyy mmmm dd")); htmlTemplate = htmlTemplate.Replace("{SubProductCatName}", tender.SubProductCatName); mailContent = htmlTemplate; } </code></pre> <p>the mail send by this code are send without any formatting means no css is applied on it </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload