开发者

CSS-to-HTML Email converter [closed]

开发者 https://www.devze.com 2023-02-07 06:38 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_StackOverflow

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

I'm on a project where we're going to be sending HTML emails. I've done dozens of projects where we send plaintext emails but for some unknown reason, I've never had to do HTML emails.

I "grew up" with tables. I used to use them for layout development. Then CSS came along with its "layers" as we called them back then, and I changed my ways pretty rapidly. By 2002, I wasn't using tables for layouts at all.

We're almost a decade on and I've been writing pretty good code consistently. I'm now faced by something quite terrifying: writing bad code on purpose. I'm not sure if my mind or fingers will allow it.

So instead of starting by writing bad code, can I write my emails like I would with any other design-build-out: with beautiful divs and CSS, and then use something evil to convert it all out? I realise this might cause issues with background images (of which there may be a couple), but I'm sure I can man-up enough to "fix" those.

I should add that we will have a number of dynamic emails being generated and a newsletter-sender. Ideally this should be something I can plug onto the end of that process so emails get generated in "standards mode", then flown through Mordor to come out the other side as beastly 90's HTML.


There is no way to autmatically turn css and div based HTML pages into working tables that work in emails.

And you probably already know normal CSS style tag is not working in webmail like gmail and hotmail.

But most email clients support embedded css, yes I know its not something you would like to do in any normal page but for email its the only way to avoid having to use font tags.

Here is a page with some of the css and what clients it works in http://www.campaignmonitor.com/css/

But for layout, tables is the only stable way to go for any more complex layout, especially if you like multiple columns or borders but my advice after 10 year of coding for emails is to try to keep it as simple as possible, think typewriter style letters with a few images, a header and footer and no more, that almost always work.


Try premailer.. http://premailer.dialect.ca/ its written in rb.. if you want the same in php.. then try https://gist.github.com/1204853


There's a tool called Premailer which might be a step in the right direction.

You still can't use divs and floats but it at least alleviates the need for writing your styles inline. You just write your styles in a <style> tag and it'll inline-ify them for you.

https://github.com/alexdunae/premailer


found out something http://www.pelagodesign.com/sidecar/emogrifier/ .. its written is php.. and its awesome... :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号