Hey All,
I am trying to send a mail that contains a body as an HTML Body but that HTML code contains JavaScript code that is not executing when I am sending the mail.
Have enabled the IsHTMLBody option.
HTML Body:
"<!DOCTYPE html><html><head><style>p{font-family: arial, sans-serif;}table {font-family: Arial, Helvetica, sans-serif; border-collapse: collapse; width: 100%;}td, th { border: 1px solid #dddddd;text-align: left;padding: 8px;}tr:nth-child(even){background-color: #f2f2f2;}tr:hover {background-color: #ddd;}th { padding-top: 12px; padding-bottom: 12px; text-align: center; background-color: #000000; color: white;} .badAnswer { font-weight: bold; } .Answer { font-weight: bold;background-color: #000000; color: white; }</style></head><body><p>Hello All,</p><p>Please find below Test progress report:</p><p>The overall test progress is <span style=""background-color: rgb(255, 255, 0);"">22%</span></p><p>Report date: 16.06.2022 07:06 AM CET.<br><br></p><br><table id=""myTable""><tr><th>Scenario</th><th>Failed</th><th>NA</th><th>No Run</th><th>Not completed</th><th>Passed</th><th>Total (W/o NA)</th><th>Total Percentage</th></tr><tr><td>Total</td><td>2</td><td></td><td>14</td><td>2</td><td>5</td><td>23</td><td></td></tr><tr><td>% without NA</td><td>9%</td><td></td><td>61%</td><td>9%</td><td>22%</td><td></td><td></td></tr><tr><td>01 Free text process</td><td>2</td><td>0</td><td>9</td><td>2</td><td>5</td><td>18</td><td>27.78%</td></tr><tr><td>02 Catalogue Process</td><td>0</td><td>0</td><td>5</td><td>0</td><td>0</td><td>5</td><td>0.00%</td></tr></table><br><p>Regards, <br>CTS Team</p><script> var x = document.getElementById(""myTable"").getElementsByTagName(""td""); x[13].style.backgroundColor = ""yellow"" const tableMath = document.getElementById('myTable'); var rc0;for (let line=1; line < tableMath.rows.length; line++) { rc0 = tableMath.rows[line].cells[0].textContent; if ( rc0 != ""Total"" && rc0 != ""% without NA"") { tableMath.rows[line].cells[0].classList.add('badAnswer') } else tableMath.rows[line].cells[0].classList.add('Answer')}</script></body></html>"
Please help me with this.