locked
SendEmail and special character in State Machine Workflow RRS feed

  • Question

  • Hi,


    I use a SendEmail activity in a State Machine workflow (SharePoint 2010) to send an email.

    The body message may contain french characters (é, è...) but it seems these characters cannot be used because they are automatically replaced (even through there is no problem logging them using SPWorkflow.CreateHistoryEvent)

            private void sendEmailToFixIncident_MethodInvoking(object sender, EventArgs e)
            {
                SendEmailTo = RetrieveEmailTo();
                SendEmailSubject = "something";
                LogComment(MessageBody()); //OK  élsève de l'orêal
                SendEmailBody = MessageBody(); //Received email with C)lsC(ve de l'orC*al
            }


    • Edited by okdreamy Monday, July 1, 2013 8:12 AM
    Monday, July 1, 2013 8:04 AM

All replies

  • When setting the message body use Httputilility.htmlencode / Httputilility.htmldecode . I dont remember the correct one pls try it out.

    Thanks Santhosh V

    Monday, July 1, 2013 7:10 PM
  • I am not sure where to use the Httputility.encode/decode. MessageBody() is a string method.
    Monday, July 1, 2013 8:33 PM
  • SendEmailBody = SPHttpUtility.HtmlDecode(EmailBodyDev());
    SendEmailBody = SPHttpUtility.HtmlDecode(EmailBodyDev()); //returns the same thing 
    C)lsC(ve de l'orC*al
    
    SendEmailBody = SPHttpUtility.HtmlEncode(EmailBodyDev()); //I can see the html code because my string method returns some html code


    Tuesday, July 2, 2013 6:26 AM
  • still couldnt find a fix for this... does anyone have an idea?
    Wednesday, July 3, 2013 9:45 AM
  • Ya sure. in the second say, where you get the html use it . Now please set the property ishtml to true. This will   mostly be availabe with the body tag.

    Thanks Santhosh V

    Wednesday, July 3, 2013 12:08 PM
  • the property ishtml is only available if I use
    SPUtility.SendEmail 
    to send email, not the sendemail activity...
    Thursday, July 4, 2013 7:34 AM