title: How to Properly Add CSS in a MailMessage
body: <p>I'm writing some HTML to a MailMessage.Body and would like to include some CSS to format fonts, tables, etc.  I'm having trouble getting the final HTML to be formed properly.</p>
  
  <p>For example:</p>
  
  <pre><code>public static void CreateMessageWithMultipleViews(string server, string recipients)
  {
      // Create a message and set up the recipients.
      MailMessage message = new MailMessage("jane@contoso.com","joe@contoso.com");
  
      // Construct body as HTML. 
      message.Body = @"&lt;html&gt;
          &lt;head&gt;
              &lt;style&gt;
                  p{
                      font-family:""Trebuchet MS"", Arial, Helvetica, sans-serif;
                      font-size:0.9em;
                      text-align:left;
                  }
              &lt;/style&gt;
          &lt;/head&gt;
              &lt;body&gt;
                  Some body text
              &lt;/body&gt;
          &lt;/html&gt;");
  
      // Set this property so that HTML renders
      message.IsBodyHtml = true;
  
      // Send the message.
      SmtpClient client = new SmtpClient(server);
      client.Credentials = CredentialCache.DefaultNetworkCredentials;
  try 
  {
      client.Send(message);
  }
  catch (Exception ex) 
  {
      Console.WriteLine("Exception caught: {0}", 
      ex.ToString() );
  }
  </code></pre>
  
  <p>My email recipients all use Outlook 2010 and this renders exactly as expected.  But I have a hard time liking it -- there are repeated <code>&lt;html&gt;</code> and <code>&lt;header&gt;</code> tags in the final email source:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=us-ascii"&gt;
      &lt;/head&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;style&gt;
              [..truncated..]
  </code></pre>
  
  <p>So my question is, how do I properly set the HTML source of an email using MailMessage so that it is well formed?  I see a 'Header's property in the MailMessage class, but that is for the message headers, not HTML headers.  Do I need to put the CSS code somewhere else possibly?</p>