Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I copied the following code out of MSDN. I am trying to make the Alternate View email method work, but am having some difficulty.

 

I receive a "{"Illegal characters in path."}" error. ANy suggestions?

 

   // Construct the alternate body as HTML.
   string body = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
   body += "<HTML><HEAD><META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">";
   body += "</HEAD><BODY><DIV><FONT face=Arial color=#ff0000 size=2>this is some HTML text";
   body += "</FONT></DIV></BODY></HTML>";

   // Add the alternate body to the message.
   AlternateView alternate = new AlternateView(body, MediaTypeNames.Text.Html);//error here
   message.AlternateViews.Add(alternate);

Go Beavs!!!
Posted

Nevermind, I got it to work.

 

           string body = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
           body += "<HTML><HEAD><META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">";
           body += "</HEAD><BODY><DIV><FONT face=Arial color=#ff0000 size=2>this is some HTML text";
           body += "</FONT></DIV></BODY></HTML>";

           AlternateView alternate = AlternateView.CreateAlternateViewFromString(body,null,"text/html");
           message.AlternateViews.Add(alternate);

Go Beavs!!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...