1

I am using a SendEmail method in a c# coded workflow for SP2010 to send out mails for approval, the problem is that for example "æøå" in the body turns into "C8C&C%".

Subject title however does not seem to be affected.

I have UTF-8 as outgoing e-mail setting in the central administration system settings (this can't be changed since it affects production environment).

Have checked out these links, but no luck implementing them so far(maybe you have working example for my code): vintentou.wordpress social.msdn,microsoft

My method goes like this:

    private void SendEmail(String emailto, String title, String body)
    {
        SPSite site = new SPSite(SharepointMainSite);
        SPWeb website = site.OpenWeb();
        SPUtility.SendEmail(website, false, false, emailto, title, body);
    }
2
  • 1
    Did you try SPUtility.SendEmail(website, false, true, emailto, title, body); So that the message body is encoded. Dec 5 '14 at 9:48
  • Yes, no change.
    – Skruf
    Dec 5 '14 at 10:06
0

Found out the error myself which turned out to not be code related at all. Was using a 3rd party program called smtp4dev which hosts smtp service and catches all mails sent, useful for testing. Not so good for special characters though.

Switched to real smtp server for testing, characters came out fine.

0

For better output as well as solution for this you do one thing.

1.Save your mail subject and body in a separate list as different columns.

2.Then fetch the list data in your method.

  1. After that bind the list columns for your email subject and body.

using this practice your issue for the special characters will be resolved as well as you can provide more flexibility and security to your code.

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.