|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
HTML mail does not work?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 = 'some***@thisnewsgroup.com 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 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. -- Show quoteHide quoteHTH, Kevin Spencer Microsoft MVP ..Net Developer Ambiguity has a certain quality to it. "Roel Korsten" <spam_sucks> wrote in message news:OhrhK5czFHA.3836@TK2MSFTNGP10.phx.gbl... > 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 = 'some***@thisnewsgroup.com > 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 > > Thanx Kevin! Now it works like a charm...
Kevin Spencer schreef: Show quoteHide quote > 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. > > "Roel Korsten" <spam_sucks> wrote in message > news:OhrhK5czFHA.3836@TK2MSFTNGP10.phx.gbl... > > 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 = 'some***@thisnewsgroup.com > > 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 > > > >
Other interesting topics
Master Pages, seems like it causes more problems than it fixes?
javascript call ViewState got confused between two user controls in same parent ct SqlDataSource - strange error (to me at least) ;-) NullReferenceException for System.Data.SQLClient getvalue from user control Menues with v1.1? Set Label Font? Which account neets permission to read the Registry key. SKMMenu and SSL |
|||||||||||||||||||||||