6

In Microsoft's infinite knowledge it appears as though they force all emails to be sent as HTML in SharePoint 2010+. This is causing a great deal of pain as the emails that are sent from the SharePoint workflow are being 'consumed' by a mechanism and input into SQL. I have gotten an HTML stripping function added to my SQL server so that it can read the emails properly but some of the emails send as iso-8859-15 and some send as utf-8 despite my setting the 'outgoing email' charset to iso-8859-15. The UTF-8 emails are getting a base-64 encoding on it which is causing the emails to get jarbled by the consumption mechanism.

TLDR - I believe that if I were able to send all emails from workflows as plain text my woes would be forever gone. Is there a way from SharePoint Designer 2010 to force emails to send as plain text?

I found this article and AsherNotts states that he can use a string builder to strip the HTML but I do not understand how?

  • 1
    If you're wanting to put workflow results into SQL, I would suggest using custom actions to push them in there directly, rather than using an intermediary like email. You may even be able to find such a custom action already written for you on codeplex or the rest of the internet. – Ashley Oct 17 '13 at 22:36
  • @AshleySteel, Thank you for the suggestion. Unfortunately, we cannot integrate the two SQL databases to each other as they are on separate servers. The destination SQL Database is EMR related so direct modification of the data via SQL gets touchy. – LukeP Nov 5 '13 at 21:30
  • But something still has to modify the SQL database to put the data in there. I'm not talking about merging SharePoint db and your external db, just a custom workflow action that you give the connection string to connect to the external database. What is it that you're currently hoping will process the emails to put them into the database, is that something you've written? – Ashley Nov 6 '13 at 9:03
  • @LukeP Did you ever manage to get the AsherNotts answer to work. There is a follow on answer which I don't understand either. – Nattrass Jul 25 at 9:37
  • @Nattrass - I'm sorry it has been too long and I don't remember. – LukeP Jul 25 at 22:32
3

I don't know about sending emails plaintext, but to strip HTML you edit the properties of the send email action.

Workflow Email Properties

Then edit the HTML of the email body directly you can use the string builder (ellipsis).

Email Body Codebehind

  • 1
    Thank you for you response. I do not have any HTML in the string builder to remove but every email that gets sent out from SharePoint has HTML in it when I look at the source code. – LukeP Oct 15 '13 at 18:45
  • Sorry that didn't help. That's the one trick I know for removing HTML from emails in SharePoint Designer. It might not be possible at all through SPD; you might want to explore a solution in Visual Studio. – Aron Foster Oct 15 '13 at 18:50
  • Alright, thank you for trying. I would vote your answer up for being helpful but I do not have enough rep at the moment. – LukeP Oct 15 '13 at 19:05
  • 4
    No, if my solution doesn't work I don't think it should be marked as an answer. Hopefully leaving this question unanswered will lure someone who actually knows how to do it. – Aron Foster Oct 16 '13 at 12:33
  • 1
    I agree with Aron, I will not accept it as the answer as it is not truly the answer and someone else might know how to help. It is a helpful post though and I finally have enough reputation to +1 it :) – LukeP Nov 5 '13 at 21:39
1

there is an old codeplex component that you can tweak to do this.

it is at https://spdactivities.codeplex.com/SourceControl/latest#DP.Sharepoint.Workflow

i have this working with SharePoint 2013 on-prem.

you have to remove line

mail.IsBodyHtml = true;

from the common.cs file and recompile it.

then in your work flow, instead of using an out of the box email task, you use enter image description here

cheers.

  • Any idea bout how can we do that for SharePoint online. – Niranjan Kulkarni Jul 2 at 14:16

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.