473,387 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Class MailMessage: reference a CSS in a newsletter

Hello,

I am starting the development of a newsletter
The use of the class MailMessage of System.Net.Mail is quite straightforward for usual contact forms but my question here is "How can I reference a CSS file in the header of my newsletter message ?"

Here is where I am ....

(1) I found a way to reference a web page in the body of the message (ref: http://www.systemwebmail.com/faq/3.2.aspx)

Dim mail As New MailMessage()
.....
Dim url As String = "http://www.MySite.com/MyPage.html"
mail.Body = HttpContent(url)
mail.BodyFormat = MailFormat.Html
mail.UrlContentBase = url
.....
Actually I would like to programmatically build the Body and therefore this solution lacks flexibility in my scenario
(2) I also looked at the Headers, UrlContentLocation and UrlContentBase properties as possible solutions to add a reference to a CSS file but found to practical answer to my question.

Thanks in advance for your support,

Michel


Oct 5 '06 #1
1 4648
This areticle has some great tips for building HTML newsletters:
http://www.alistapart.com/articles/cssemail/

The best solution is to use inline CSS, rather than link to an external
stylesheet.

Michel Couche wrote:
Hello,

I am starting the development of a newsletter
The use of the class MailMessage of System.Net.Mail is quite straightforward for usual contact forms but my question here is "How can I reference a CSS file in the header of my newsletter message ?"

Here is where I am ....

(1) I found a way to reference a web page in the body of the message (ref: http://www.systemwebmail.com/faq/3.2.aspx)

Dim mail As New MailMessage()
....
Dim url As String = "http://www.MySite.com/MyPage.html"
mail.Body = HttpContent(url)
mail.BodyFormat = MailFormat.Html
mail.UrlContentBase = url
....
Actually I would like to programmatically build the Body and therefore this solution lacks flexibility in my scenario
(2) I also looked at the Headers, UrlContentLocation and UrlContentBase properties as possible solutions to add a reference to a CSS file but found to practical answer to my question.

Thanks in advance for your support,

Michel


------=_NextPart_000_001F_01C6E869.2C28A870
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Google-AttachSize: 2175

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.5700.6" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I am sta</FONT><FONT face=Arial size=2>rting the
development of a newsletter</FONT></DIV>
<DIV><FONT face=Arial size=2>The use of the class MailMessage of System.Net.Mail
</FONT><FONT face=Arial size=2>is quite straightforward for usual contact forms
but my question here is "How can I reference a CSS file in the header of my
newsletter message ?"</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Here is where I am ....</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>(1) I found a way to&nbsp;reference a web page in
the body of the message (ref: <A
href="http://www.systemwebmail.com/faq/3.2.aspx">http://www.systemwebmail.com/faq/3.2.aspx</A>)&nbsp;</DIV>
<DIV><BR>&nbsp;&nbsp; Dim mail As New MailMessage()<BR>....<BR>&nbsp;&nbsp; Dim
url As String = "<A href="http://www.MySite.com"><FONT
color=#000000>http://www.MySite.com</FONT></A>/MyPage.html"<BR>&nbsp;&nbsp;
mail.Body = HttpContent(url)<BR>&nbsp;&nbsp; mail.BodyFormat =
MailFormat.Html<BR>&nbsp;&nbsp; mail.UrlContentBase = url<BR>....</DIV>
<DIV>Actually I would like to programmatically build the Body and therefore this
solution&nbsp;lacks flexibility in my scenario&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>(2) I also looked at the Headers, UrlContentLocation and UrlContentBase
properties&nbsp;as possible solutions to add a reference to a CSS file but found
to practical answer to my question.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks in advance for your support,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Michel&nbsp;</DIV>
<DIV><BR>&nbsp;</DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_001F_01C6E869.2C28A870--
Oct 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: cooldv | last post by:
i have an *access database + ASP newsletter* that is working fine and it sends newsletter to ALL the email addresses in the DB. i want to send this newsletter to only a select group (like people...
5
by: martin | last post by:
Hi, I have created a class that is totally seperate from my web application. However this class is used extensivly by the web application for stuff like data access. I wish to add a function to...
2
by: Mark Sandfox | last post by:
I have created a newsletter that I want to send to a list of 200 users (yes they all have requested it). I know this can be created line for line using htmlTextWriter but that is cumbersome at...
1
by: asnowfall | last post by:
I am creating MailMessage out of already existing email message. My existing message has few custom properties. I wan to add them to System.Net.Mail.MailMessage How to add custom properties? ...
2
by: Helter Skelter | last post by:
hi, i want to create a new instance of the MailMessage class in ASP.NET. i have used <%@ include System.Net.Mail %>. my code is: <script runat="server"> //Create a new instance of the...
1
by: D Witherspoon | last post by:
Coming up with a scenario here. For example there is the standard .NET MailMessage class. I am creating a project (let's call it CommonBase) that has the following 2 classes ...
5
by: D Witherspoon | last post by:
What is happening is that I have a class (ClassA) that inherits a class (ClassB) which inherits System.Net.Mail.MailMessage Project 1 references Project 2, Project 2 references Project 3. ...
4
by: a | last post by:
Hi I want my application uses the instance of MailMessage and SmtpMail classes to send email. How can I add a reference to the System.Web.dll assembly to use these classes? Do the SmtpMail...
11
by: ginoplusio | last post by:
Hi, I'm developing a software to send newsletter to the users of my website. I have a problem on the stats, detecting the opening of the newsletter on the user's client. The method I've chosen...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.