Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a list field that contains hyperlinks and richtextformat. To send the emai I am using

    Spweb web = spcontext.current.web;
    StringDictionary headers = new StringDictionary();

    headers.add("to","someone@email.com");
    headers.add("from","me@rmail.com");
    headers.add("subject","helloWorld");
    headers.add("content-type","text/html");  //default

    string body= (string) listitem["RichTextField"]

    SPSecurity.RunWithElevatedPrivliges(delegate(){
         SPUtility.SendEmail(web, headers, body);
    });

It sends the hyperlinks fine but the rest is sent as plain text. Is this a result of Exhange or is RichText!=HTML ?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

(string)listitem["RichTextField"]; does return with html tags for me, turns out what I was missing was an additional header tag

    headers.Add("fAppendHtmlTag","True");
share|improve this answer
add comment

try this

SPField field = listitem.Fields["RichTextField"];
string body= field.GetFieldValueAsHtml(listitem["RichTextField"]);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.