johnnys Posted June 7, 2013 Share Posted June 7, 2013 (edited) HI, Relatively new to php here but experience with html & css. I have recently taken over a project from somebody, and I'm trying to make some minor adjustments to a few areas (mostly aesthetic). The system as a whole works fine, and can read from/write to the databases, as well as send emails etc... However I am encountering an issue which has me stuck, I have a button on my site 'compose email to user', when clicked a table is pulled from a database (ip_requests) displayed within a tinymce editor, 2 columns, 10 rows, border etc.. however when I click 'send' the table does in fact send successfully but the formatting seems to be ignored. The email arrives, containing all the information, however no border, bold, or coloured table cells. It seems like there is a 'strip html' command somewhere. Below is a sample of the code that produces the table within the tinymce editor; $strHtmlOutput.= ' <tbody> <tr> $strHtmlOutput.= '<tr> <th>Date of Request</th> <td> '.$result['cdate'].' </td> </tr> '; $strHtmlOutput.= '<tr> <th>Date Last Modified</th> <td> '.$result['mdate'].' </td> </tr> '; } $strHtmlOutput.='</tbody> </table>'; There is a lot more code in the page itself, however maybe some whizz will be able to help me based on the above code only? Excuse my ignorance in this! I have lots of 'compose email to user' buttons on my sitem which allows me to send the data on screen to an individual via email, but they all do the same (strip email formatting). So this must be a global setting? Any help would be appreciated. Thanks in advance, J Edited June 7, 2013 by johnnys Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/ Share on other sites More sharing options...
requinix Posted June 7, 2013 Share Posted June 7, 2013 The thing you posted doesn't have any HTML stripping so... can't really say. There being such a thing would explain what you're experiencing, but without the code it's anybody's guess where that's happening. Follow the path the code takes, where $strHtmlOutput goes from that point to where it's put into the email. Put some echos or logging statements or something so you can find out where the HTML is being stripped. Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1434700 Share on other sites More sharing options...
Jessica Posted June 7, 2013 Share Posted June 7, 2013 What you posted isn't even valid code. Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1434718 Share on other sites More sharing options...
johnnys Posted June 10, 2013 Author Share Posted June 10, 2013 thanks for the tips requinix Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1435154 Share on other sites More sharing options...
chriscloyd Posted June 11, 2013 Share Posted June 11, 2013 $strHtmlOutput = <<<EOT <table> <tbody> <tr> <th>Date of Request</th> <td>{$result['cdate']}</td> </tr> <tr> <th>Date Last Modified</th> <td>{$result['mdate']}</td> </tr> </tbody> </table> EOT; Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1435265 Share on other sites More sharing options...
johnnys Posted June 11, 2013 Author Share Posted June 11, 2013 wow thanks chriscloyd - this works what exactly is that doing differently than I was? Oh I also had to change the $mail->Body from $emailcontent to $strHtmlOutput. thanks very much Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1435299 Share on other sites More sharing options...
cyberRobot Posted June 11, 2013 Share Posted June 11, 2013 wow thanks chriscloyd - this works what exactly is that doing differently than I was? Oh I also had to change the $mail->Body from $emailcontent to $strHtmlOutput. thanks very much As Jessica mentioned, the original code is invalid. The first string wasn't ended, for example. This: $strHtmlOutput.= ' <tbody> <tr> $strHtmlOutput.= '<tr> <th>Date of Request</th> <td> '.$result['cdate'].' </td> </tr> '; Should be: $strHtmlOutput.= ' <tbody> <tr>'; //<-- close string here $strHtmlOutput.= '<tr> <th>Date of Request</th> <td> '.$result['cdate'].' </td> </tr> '; Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1435316 Share on other sites More sharing options...
Q695 Posted June 11, 2013 Share Posted June 11, 2013 (edited) $strHtmlOutput.= ' <tbody> <tr> $strHtmlOutput.= '<tr> <th>Date of Request</th> <td> '.$result['cdate'].' </td> </tr> '; $strHtmlOutput.= '<tr> <th>Date Last Modified</th> <td> '.$result['mdate'].' </td> </tr> '; } $strHtmlOutput.='</tbody> </table>'; missing a single ' $strHtmlOutput.= ' <tbody> <tr>'; $strHtmlOutput.= '<tr> <th>Date of Request</th> <td> '.$result['cdate'].' </td> </tr> '; $strHtmlOutput.= '<tr> <th>Date Last Modified</th> <td> '.$result['mdate'].' </td> </tr> '; } $strHtmlOutput.='</tbody> </table>'; Edited June 11, 2013 by Q695 Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1435318 Share on other sites More sharing options...
johnnys Posted June 11, 2013 Author Share Posted June 11, 2013 ah ok well thanks Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1435338 Share on other sites More sharing options...
Solution Q695 Posted June 11, 2013 Solution Share Posted June 11, 2013 Is it solved? Quote Link to comment https://forums.phpfreaks.com/topic/278901-html-being-stripped/#findComment-1435398 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.