简体   繁体   中英

How can Javascript code be displayed as plain text in the body of an HTML email?

I have an email that gets sent which outputs the text of HTTP error responses. If the response ever includes Javascript code in <script> tags (and some HTML code) then the Gmail (and many other email clients) strip out the code.

Also, if there is anything after the </script> that seems to get stripped out as well.

How can I make it so that the Javascript code is not stripped out and just gets included as plain text in the body of an HTML email?

I think you can use HTML entities

&#x3C;script&#x3E;code&#x3C;/script&#x3E;

or

&lt;script&gt;code&lt;/script&gt;

should become

<script>code</script>

when rendered

You can use this tool

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM