Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 171609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:01:05+00:00 2026-05-11T13:01:05+00:00

Has anyone found a good way of embeding CSS in a programatically produced email.

  • 0

Has anyone found a good way of embeding CSS in a programatically produced email. The best way I have found is to put the style code into a resource file and call it into the code.

An emample would be

Dim objBuilder objBuilder = New StringBuilder  objBuilder.Append(Resources.SystemEmail.CSSStyle) objBuilder.Append('My Styled Email')  Dim _Body As String = objBuilder.ToString() 

This would build the body of the email

Is there any way to make a template file for an email or a better way to call a style sheet into one.

The code in my .resx file would be

<STYLE TYPE='text/css'> <!-- body {      font-family: Tahoma, Verdana, Arial;     font-size: 10pt;     padding: 3px 0px 0px 0px;     margin: 0px 0px 0px 0px;  } --> </STYLE> 

And calling this into the string would call this inline

And with the answers below to send the message I would use this

Dim client As New SmtpClient('localhost') Dim toAddr As New MailAddress(MailRecipients) Dim fromAddr As New MailAddress(MailFrom) Dim message As New MailMessage(fromAddress, toAddress)   message.Subject = 'The Subject' message.Body =  _Body  message.IsBodyHtml = True message.BodyEncoding = System.Text.Encoding.UTF8  client.Send(message) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:01:06+00:00Added an answer on May 11, 2026 at 1:01 pm

    The only way we’ve been successful is to include the CSS inline. Document Header style CSS inclusion isn’t consistent or reliable.

    Also, make sure your email headers are set to: Content-type: text/html; charset=ISO-8859-1

    EDIT UTF-8 is also a good option. The KEY point of that statement is the Content-type being set to text/html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone found a good method of mocking out ADO.Net Data Service calls from
Has anyone found a way to get around this? Or a better technique to
Has anyone found a way to save a FlowDocument as BAML or other compressed
Has anyone found any documentation or research about what data is transfered to Google
Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes
Given that Chrome and Safari use webkit has anyone yet found anything that renders
I've found an article on this subject by a Microsoft employee, but has anyone
Has anyone come across a good solution for using ./Views/Shared/DisplayTemplates and ./Views/Shared/EditTemplates with the
Has anyone tried installing SQL Server 2008 Developer on a machine that already has
Has anyone ever set up Cruise Control to build an OS X Cocoa/Objective-C project?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.