In SP 2010, I'm using SPUtility.SendEmail and it is working fine except for sending links. In the body string argument, I input

"<a href=\"http://www.google.com\">Click me</a>"

It appears in the email as the html code that I want (the text code, I can't put it here because it will be formatted to be a link)

And when I view the source of the email, I see

&lt;a href=&quot;http://www.google.com&quot;&gt;Click me&lt;/a&gt;

I know html is working as I am using bold and newline tags, but I can't figure out how to get the link to work.

    public static bool SendEmail(
    SPWeb web,
    bool fAppendHtmlTag,
    bool fHtmlEncode,
    string to,
    string subject,
    string htmlBody)

You should set the parameters:

fAppendHtmlTag true to append an HTML tag to the message; otherwise, false.

fHtmlEncode true to encode the message and replace characters in HTML tags with entities; otherwise, false.

  • That was it, I had them both set to true. Thank you! – user18184 Oct 8 '13 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy