2

i have been working on generating email in an event receiver using share point object model..i used the sputility.sendemail method..2 things are necessary in the email(email from and HTML body)..so i used the SpUtility method...

public static bool SendEmail(
SPWeb web,
StringDictionary messageHeaders,
string messageBody

) but this method strips any HTML present in the body..so i looked same method diff parameters..

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

)

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

) the above functions do provide the html body but no 'from' parameter...how can i have both the 'from' and 'body(HTML support)' parameters..any suggestions?

3

Try to specify headers in this way:

var headers = new StringDictionary();
headers.Add("subject", "Hi!");
// "text/html" to send rich html text in message body
headers.Add("content-type", "text/html");
headers.Add("to", "some@address.com");
headers.Add("from", "some@mail.com");
SPUtility.SendEmail(web, headers, "<b>Hi there!</b>");

Your Answer

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

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