I need to send a rich formated html with lots of css in it.. The problem with mail is that only inline css works.. and i can use that for some part of the mail. the rest is in need to highlight some codes.. which changes for every email.. what i need is some syntax highlighter that can really glow the different codes like c, c++, java, php etc with syntax colors. And i need to do that in php. What is the best server side syntax highlighter can be used.
Or else is there anyway to email a webpage completely with full css support.
There is this project on GitHub , written in Python, which takes an HTML document and converts all the styles to inline CSS. There is a web page which shows it working.
If you know Python, or know someone who does, you could probably port it to PHP without much difficulty.
I found it by Googling "convert css to inline" - it is the first result, if you look further down the results, you may find a PHP based solution.
PHP source code can be highlighted by using the highlight_string()
function - I'm sure other languages provide similar functionality, and there are also projects like this one .
我使用了称为emogrifier的东西,它是用PHP编写的,并且很酷。
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.