[thelist] CSS in HTML E-mail?

Kasimir K evolt at kasimir-k.fi
Thu Dec 15 16:22:32 CST 2005


Felix Miata scribeva in 2005-12-15 19:43:
> A (formerly) very popular one designed before Cascading Style Sheets,
> level 1 W3C Recommendation 17 Dec 1996, the one I've been using for all
> list mail and most email since my first day on the web.

One of the fundamental characteristics of the internet is how quickly it 
evolves and changes. Denying that and sticking to the solutions of "good 
old days" might not always be the best approach. I used email before the 
web existed, but while those were exiting times, and while I do dislike 
bloat, I'd rather not use the mail clients of those days on regular 
basis, nor would I base my advice to fellow developers on such clinging 
to the past.

I do appreciate that Felix's mail client has features not found in 
modern mainstream programs, and I'm obviously not criticizing his 
software choices. But I think that last millennium's software is not 
necessarily a good base for today's decisions.

> IOW, email existed before HTML and CSS.

It indeed did. It actually predates not only the web, but also the 
internet.

> Those for whom it worked before M$'s email corruption genesis

I personally don't like Microsoft's business practices, and many of 
their engineering choices do leave a lot to hope for. But I don't think 
that thelist is the correct forum to voice out my personal dislikes.

> shouldn't be required to "upgrade" to
> something worse than what they have just to get support for something
> they don't want.

Yes, I agree. When using HTML in emails, it should be done so that those 
using non-HTML-capable mail clients could read the message too.

> People who have messages they think belong in HTML/CSS email really have
> messages that should be little more than links to web pages that
> recipients can view/download if and when they choose by opening an email
> link.

This may often be the case - but many times it is not.

> All email I get with attachments or CSS or HTML is trapped into the
> trash by my filtering.

I find this rather extreme and rare - most of email users do accept 
attachments and HTML. And if the OP already has decided to send HTML 
emails, I can't see how this helps him.

And as my mail too is lacking any useful advice to the OP, I think I owe 
a tip ;-)


.k


<tip type="php" author="kasimir k">

Often you want to give a variable a value of another variable if it is 
set, otherwise you want a default value.

You could do it like this:
if (isset($_GET['var'])) {
    $var = $_GET['var'];
} else {
    $var = 'default value';
}

or as a oneliner with ternary operator:
$var = isset($_GET['var']) ? $_GET['var'] : 'default value';

but it is a bit tiresome to repeat oneself like that :-)

So I've made a little helper function, Set If Not Set:
function sins($var, $default = '') {
    return $var ? $var : $default;
}

Now I can just:
$var = sins($_GET['var'], 'default value');

Much shorter than if-else, and a bit shorter and less silly looking than 
ternary :-)

</tip>



More information about the thelist mailing list