Title: Can't load CSS stylesheet in moodle
Tags: html;css;html-email;moodle
Question: I run a Moodle 2.9 server, and while configuring the email to be sent to the user, I created a CSS stylesheet to be included to format said email. However, when I try the email, it appears non-formatted. I'm putting the text in question in a php variable inside a config file in moodle like this.

```$string['newusernewpasswordtext'] = '
<html&gt;
<head&gt;
<style type="text/css"&gt;
@import url(https://fonts.googleapis.com/css?family=Roboto:400,400italic,500,500italic);

@import url(https://fonts.googleapis.com/css?family=Roboto+Condensed:400,400italic);


@font-face{
font-family:FontAwesome;
src:url(https://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.eot?#iefix) format(\eot\'),
url(https://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.woff) format(\'woff\'),
url(https://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.ttf) format(\'truetype\'),
url(https://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.svg#FontAwesome) format(\'svg\');
font-weight:400;font-style:normal;
}

@import url("http://xxx/mail.css");

h1 {
    font-size: 3.5em;
    color: #E52B38;
    font-family: \'Roboto\', sans-serif;
    line-height: 100%;
    font-weight: 400;
    letter-spacing: 2px;
}


</style&gt;
```

I also tried including or linking the css file from within the body tags, to no avail. I have seen that the fonts are being loaded since one single element on the email has an inline formatting and is being rendered accordingly. However, i do not want to resort to inline formatting. 

Thanks and I'm open to any suggestions

Comment: Emails are a fickle beast.  Common wisdom dictates that all styles should actually be inlined, as some clients will strip out  and  blocks.  My suggestion would be to author the email as you normally would, than use an inliner tool.  Something like this: http://templates.mailchimp.com/resources/inline-css/ or even this: http://zurb.com/ink/inliner.php

Comment: You're going to run into issues using pseudo's either way: https://www.campaignmonitor.com/css/

Comment: I hear ya, that's where we're still at for email :(

Comment: Yea, it should probably be entered statically, either through your email build system or manually. When the email arrives, it'll be timestamped anyway, so it won't look funny if a user opens the email two years from now.  If you ABSOLUTELY must have that dynamic (boss is making you), use JavaScript's `new Date().getFullYear()` , and place the static year next to it in a  block.  That way you cover both bases as there will be email clients that do not support JS.

Comment: Tried zurb and the pseudo elements got lost, as i was guessing they would. Thanks anyway

Comment: thanks! i used a mixed solution, putting the complex elements in images and Voila!! i don't like it, is so 1996 but it works, so thanks!!

Comment: i need to show the current year in that same email (loaded automatically), any ideas? :)

Comment: I took the lazy route and put it statically...thanks man!!



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 8, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:09/15/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<html><css><html-email><moodle>', 'Title': "Can't load CSS stylesheet in moodle", 'ViewCount': 940, 'id': 32593705, 'user_AboutMe': '<p>Who am I: A web dev, that is. Been programming for a long time. Been learning for an even longer time.</p>\n\n<p>Programmer, writer, musician (as amateur as it can get)....</p>\n', 'user_AccountId': 3030628.0, 'user_DisplayName': 'Brandon', 'user_Reputation': 125.0, 'user_Views': 40.0, 'user_id': 2569732.0}}