• Resolved dhruvsompura

    (@dhruvsompura)


    Hello,

    I am trying to save email template in email carrier. When i save the template body field is not saving the style tag. only saving the css code without style tag. So i am getting the plain text of the css code. How can i save the style tag in email body ?

    Please check this screenshots.
    1) Original email content : https://nimb.ws/CW4zMj
    2) After saving the content : https://nimb.ws/PQp2n9 – without style tags
    3) Settings of the email carrier : https://nimb.ws/Js02vA ( I try both options tick and untick)

    • This topic was modified 3 years, 8 months ago by dhruvsompura.
    • This topic was modified 3 years, 8 months ago by dhruvsompura.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Kuba Mikita

    (@kubitomakita)

    Thanks for the notice! Indeed the style tag is stripped, I’ll make sure to fix it in the next release.

    Thread Starter dhruvsompura

    (@dhruvsompura)

    Thanks for the reply.

    We are using this plugin with twillio. I have setup everything and we are in final phase to release the project, can you please guide me with some quick alternate fix ? as i am looking for quick fix. as a developer i can do Little bit of code ,so if you can help me with some technical idea, that will work .

    thanks

    Plugin Author Kuba Mikita

    (@kubitomakita)

    I’m just working on it, will link you the patch in a moment

    Thread Starter dhruvsompura

    (@dhruvsompura)

    Thanks Kuba for quick reply , You are super fast ??

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Here you go ?? https://github.com/BracketSpace/Notification/pull/328/files

    If you like the plugin and the support please consider leaving a short review. Thanks!

    Thread Starter dhruvsompura

    (@dhruvsompura)

    Thanks for super fast response and quick fix . you save my day . of course will add review ??

    Thread Starter dhruvsompura

    (@dhruvsompura)

    Hello,

    I updated the code that you send me, but style attributes are still not saved.Please check the screenshot of the file.

    screenshot : https://ibb.co/vwg4nZQ
    Path : notification\src\classes\Defaults\Field\CodeEditorField.php

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Do you have the Allow for unfiltered HTML option enabled for Email carrier?

    Thread Starter dhruvsompura

    (@dhruvsompura)

    oh yes , i missed that ,thanks , that fixed the issue . I have go ahead and added table ,td and tr tag and classes to that tags and it works fine , please add that tag in future release as email template use this tags , here is tags i have added

    public function allow_html_tags( $allowed_tags ) {
    $allowed_tags[‘style’] = [];
    $allowed_tags[‘table’] = [
    ‘style’ => true,
    ‘class’ => true,
    ];
    $allowed_tags[‘tr’] = [
    ‘style’ => true,
    ‘class’ => true,
    ];
    $allowed_tags[‘td’] = [
    ‘style’ => true,
    ‘class’ => true,
    ];
    $allowed_tags[‘div’] = [
    ‘class’ => true,
    ‘style’ => true,
    ];

    return $allowed_tags;
    }

    Hope this helps . Thanks again Kuba for your super fast support ??

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Thanks! I’m wondering if it wouldn’t be easier to just strip the harmful tags, like scripts… because looks like the sanitization function we are using don’t allow us to use of any HTML while it definitely should.

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Ok, I think it’s good to stick with wp_kses function so we’ll be extending the allowed tags if needed.

    This is the last change to this part: https://github.com/BracketSpace/Notification/commit/c45ae03ccdd032e2508a1294ddb055eeb977e57b

    Thread Starter dhruvsompura

    (@dhruvsompura)

    thanks Kuba for keep this conversation going.

    As per your code i modify my code, now working fine but still some of attributes, style tags and comments are not allowed.

    We are using the litmus email template so we want to allow everything.Please check the below document. I added all missing tags and attributes list.

    How can i allow this attributes and tags and comments in email template ?

    https://drive.google.com/file/d/1lzfquoWwzgymevvwUkheIm8zuKc5kPHT/view?usp=sharing

    on other note . what sort of function you recommend if we are plan to go ahead with allow all html tag

    Thank you.

    • This reply was modified 3 years, 8 months ago by dhruvsompura.
    • This reply was modified 3 years, 8 months ago by dhruvsompura.
    • This reply was modified 3 years, 8 months ago by dhruvsompura.
    • This reply was modified 3 years, 8 months ago by dhruvsompura.
    Plugin Author Kuba Mikita

    (@kubitomakita)

    I’m still thinking about this. Allowing for any HTML makes me nervous because this might be a security breach. On the other hand I understand a need of using the HTML template.

    But wouldn’t be better to filter the email content and wrap it with the template programmatically?

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘In email carrier body is not saving the style tag, i want to save the style tag.’ is closed to new replies.