HTML mail does not work?

R

Roel Korsten

Hello all,

I've got a strange one: I'm sending HTML mail via the System.Web.Mail
namespace:

Dim ObjEmail As New MailMessage
Dim sb As New StringBuilder

ObjEmail.To = '(e-mail address removed)
ObjEmail.From = ConfigurationSettings.AppSettings("MailFrom")
ObjEmail.Subject = OnderwerpTextBox.Text
ObjEmail.BodyFormat = MailFormat.Html

ObjEmail.Body = Funcs.Nieuwsbrief(OnderwerpTextBox.Text,
BerichtTextbox.Text.Replace(vbCrLf, "<br>"))

SmtpMail.SmtpServer = ConfigurationSettings.AppSettings("MailSMTP")

SmtpMail.Send(ObjEmail)

In the "Funcs.Nieuwsbrief" method (which populates the body of the e-mail) I
generate the following HTML:

<html>
<head>
<link href='http://www.kubbus.nl/style/styles.css' type='text/css'
rel='stylesheet'>
</head>
<body class='body'>
<table class='table_main' align='center' cellpadding='5' cellspacing='5'>
<tr>
<td colspan='3' align='center'>
<table border='0' cellspacing='0' cellpadding='0' height='124px'
width='100%'
background='http://www.kubbus.nl/images/top1.gif'><tr><td></td></tr></table>
<table border='0' cellspacing='0' cellpadding='0' height='26px' width='100%'
background='http://www.kubbus.nl/images/top2.gif'><tr><td></td></tr></table>
<table border='0' cellspacing='0' cellpadding='0' height='17px' width='100%'
background='http://www.kubbus.nl/images/top3.gif'><tr><td></td></tr></table>
</td>
</tr>
<tr>
<td colspan='3' valign='top' class='table_middle'>
<table align='center' width='70%'>
<tr>
<td colspan='3'><p align='center' class='table_header'>
Dit is het onderwerp
</p>
</td>
</tr>
<tr>
<td colspan='3'><br>
<table align='center'>
<tr>
<td class='content_black'>
Dit is het bericht
<br><br>
</td>
</tr>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan='3' align='center' class='content_black_small'>
© 2005 Café Partycentrum Kubbus - alle rechten voorbehouden
</td>
</tr>
</table>
</body>
</html>

When I look at this HTML in IE the page gets rendered perfectly. When I open
the e-mail, all the style is gone!

What's going on?

Greetings,
Roel Korsten
 
K

Kevin Spencer

You're using an external style sheet. Windows XP Service Pack 2 disallows
this by default (apparently a security issue), and the user would have to
turn it on to use the style sheet. See the following article on the subject:

http://www.emaillabs.com/articles/email_articles/windows_sp2_upgrade.html

The solution would be to write the style sheet into the HTML page that is
the body of the email.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top