Email and including a stylesheet

G

Guest

i'm sending email via an aspx page. The format is html. Is there a way to
include a link to a stylesheet? I notice that the
Dim mail As New MailMessage
mail.Body = msg
mail.BodyFormat = MailFormat.Html
will create the correct html headers but i can't figure out how to include a
link to a stylesheet in the head tag.
Any ideas?
thanks
kes
 
S

S. Justin Gengo

When you build out your html use a string builder. Append to the string
builder all the text for a regular html page with a link to a stylesheet
stored out on your website... Otherwise put all the style tags directly in
the text.

Dim MySB AS New System.Text.StringBuilder

With MySB
.Append("<html>" & vbcrlf)
.Append(vbTab & "<head>" & vbcrlf)
.Append(vbTab & vbTab & "<meta [style link here]>" & vbcrlf)
'---Etc.
End With

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
J

John MacIntyre

WebBuilder451 said:
i'm sending email via an aspx page. The format is html. Is there a way to
include a link to a stylesheet? I notice that the
Dim mail As New MailMessage
mail.Body = msg
mail.BodyFormat = MailFormat.Html
will create the correct html headers but i can't figure out how to include
a
link to a stylesheet in the head tag.
Any ideas?

This is an untested idea ...

Instead of a css link, have you tried to embed your styles right into the
body of the email? Like you can in an HTML page?

John
 
G

Guest

thanks for responding,

that is an answer, however i was hoping to use the mailmessage object
directly like when you need to add dynamic linkbuttons, or child controls. I
figure the head tag already exists in the mailmessage object (somewhere) so
you should be able to add an <a link ... stylesheet.. /> as a key or somthing.
thanks

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


S. Justin Gengo said:
When you build out your html use a string builder. Append to the string
builder all the text for a regular html page with a link to a stylesheet
stored out on your website... Otherwise put all the style tags directly in
the text.

Dim MySB AS New System.Text.StringBuilder

With MySB
.Append("<html>" & vbcrlf)
.Append(vbTab & "<head>" & vbcrlf)
.Append(vbTab & vbTab & "<meta [style link here]>" & vbcrlf)
'---Etc.
End With

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
G

Guest

thanks for responding
Can do that but can't do that. My designer will kill me, she is very strong
on standardization, which is not a Microsoft srong point. this means style
elements should be in style sheets not in-line.
Seeing as how we are married, hey you get the idea!!!!

but thanks
kes
 
S

S. Justin Gengo

That's true of a web page. But this isn't a web page is it? I would ask her
if she can point out the standardization that says there should be a
separate style sheet for an email message.

If you need a place to sleep afterward my couch is free and I have beer in
the fridge. Just be quiet so you don't wake up my wife and our five year
old. I have nowhere to go myself! :)

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
J

jack.murphy

S. Justin,

I agree to that.

My company just developed the world's first and only web-based
"web-page emailer" available at www.jkn.com

You would be amazed to know how much hurdles we had to go through to
get web pages to fit inside of an email so that it will display
properly in all email clients (even web-based ones like Hotmail and
Yahoo Mail)

CSS is only a small part of it. We had a major issue with framesets.
Even Internet Explorer can't email frameset-based web pages. But I am
proud to say that we can at www.jkn.com

Regards,

Jack Murphy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top