locked
How to change outgoing Email address for Workflow Manager 1.0 RRS feed

  • Question

  • Hi, 

    I have an installation of SharePoint 2013 Enterprise with Windows Azure Workflow Manager 1.0 on a single machine to test new features of SharePoint 2013 Workflows. 

    SharePoint Server outgoing email settings are configured properly and working. If I invite a user to a site, the email is sent with the respective settings. Same if I want to send an email via a SP2010 Workflow from this server. 

    Now if I start a SP 2013 Workflow which is using the Azure Workflow Server and want to sent a email, it fails and the mail is dropped to the badmail folder. 

    If I look into the mail file in the badmail folder, the from address is workflow@noreply and not the from address out of the SharePoint outgoing email settings. 

    Where can i change this settings? 

    Regards

    Christof

    Thursday, November 22, 2012 11:11 AM

Answers

  • This was actually fixed in the SharePoint 2013 March PU, the engine now must resolve a user from the email and if it doesn't, it will send as the outbound email address configured in the CA.

    It will not send as workflow@noreply anymore unless that resolves to an actual user in the user profile service.

    Be aware that when you install the March PU, any VS workflows will need to be re-worked as some of the namespaces changed. I am not sure about designer (SPD) workflows.

    Saturday, April 27, 2013 1:39 AM

All replies

  • I'm afraid I have bad news for you.  It seems this is compiled into the Microsoft.SharePoint.WorkflowServices.Activities.Email activity.  If you use reflector, you will see this:

    BuildDynamicValue value3 = new BuildDynamicValue();
            value3. variable // Local Variable">variable);
            value3./Add(<!0>,<!1>)" title="void System.Collections.Generic.IDictionary<String,InArgument>.Add(string, InArgument); CTRL+Click to open in new tab.">Add("properties/__metadata/type", new string>("SP.Utilities.EmailProperties"));
            value3./Add(<!0>,<!1>)" title="void System.Collections.Generic.IDictionary<String,InArgument>.Add(string, InArgument); CTRL+Click to open in new tab.">Add("properties/Subject", new string>(new string>("Subject")));
            value3./Add(<!0>,<!1>)" title="void System.Collections.Generic.IDictionary<String,InArgument>.Add(string, InArgument); CTRL+Click to open in new tab.">Add("properties/Body", new string>(new new string>("Body"), "\r\n", "<br />")));
            value3./Add(<!0>,<!1>)" title="void System.Collections.Generic.IDictionary<String,InArgument>.Add(string, InArgument); CTRL+Click to open in new tab.">Add("properties/From", new string>("workflow@noreply"));
            sequence./Add(<!0>)" title="void System.Collections.ObjectModel.Collection<Activity>.Add(Activity); CTRL+Click to open in new tab.">Add(value3);

    No where in the following code does it replace these values from anything that is input...

    That all being said, if you wanted to implement your own activity using this class as a starting point you could and then set the "properties/From" to what ever you want.


    Chris Givens CEO, Architecting Connected Systems Blog Twitter

    • Proposed as answer by Dennis Gaida Tuesday, January 22, 2013 1:03 PM
    Tuesday, December 11, 2012 4:50 AM
  • So this is a bug.

    workflow@noreply is not even a valid domain, meaning that most Mail servers will simply block the mails.

    Christ, you can't implement your own activity with custom code. You can use the E-Mail Activity, but it doesn't let you set the from address.


    Tuesday, January 22, 2013 1:03 PM
  • Hi

    I was able to fix it modifying the Xaml code for the Email Activity directly in the workflow manager database, I just remove the 'workflow@noreply' value from the xaml code.

    Note: You have to restart the Workflow Manager Back-End service in order the engine pickup the new Xaml code.

    You can change it to set up a custom value but if you keep it blank the SP Rest service will pick up the value from the Central Administration outgoing email setting.

    Enjoy it!

    • Proposed as answer by MaartenSundman Friday, January 25, 2013 9:10 PM
    Friday, January 25, 2013 8:08 PM
  • modifying the Xaml code for the Email Activity directly in the workflow manager database

    Which workflow Management Database do you mean. Which table, which column etc. I'll try to outline the steps for fellow users running into this problem:


    All Activities of Workflows are stored in the WFResourceManagementDB the name may vary depending on what prefix you chose. Within this database you have the dbo.Activities table. You can see all activities with their respective names as well as the XAML - this is what we want to edit:

    We are interested in the "EMail" Activity and the corresponding XAML. To update the current value of workflow@noreply (Shame on you MS) you have to execute the following statement. Be aware: This is unsupported by Microsoft an might be changed (hopefully) in a future release. Changes in the DB are not supported and you might break your workflow service so you have to reinstall.


    Finally the good stuff - How to change the from address (workflow@noreply) to something useful:

    UPDATE [WFResourceManagementDB].[Activities]
    SET [Xaml].modify('declare namespace ns="http://schemas.microsoft.com/netfx/2009/xaml/activities";
    					declare namespace p="http://schemas.microsoft.com/workflow/2012/07/xaml/activities";
    					declare namespace scg="clr-namespace:System.Collections.Generic;assembly=mscorlib";
    					declare namespace x="http://schemas.microsoft.com/winfx/2006/xaml";
    					replace value of (/ns:Activity/ns:Sequence/p:BuildDynamicValue/scg:Dictionary/ns:InArgument[@x:Key="properties/From"]/text())[1] with "workflow@example.org"')
    WHERE Name = 'EMail'
    As you can see I'm changing the value of properties/From to "workflow@example.org" you will have to adjust this to your liking of course.

    Afterwards you will have to restart the Workflow Management Backend Service (to be honest I'm not sure which service of the service bus is responsible for compiling all Activities, to be sure I restarted the server):




    • Proposed as answer by Dennis Gaida Sunday, January 27, 2013 2:29 PM
    • Edited by Dennis Gaida Sunday, January 27, 2013 2:39 PM
    Sunday, January 27, 2013 2:29 PM
  • Wow, nice job!  I stand corrected!  Very helpful bit of sleuthing on that!

    Chris Givens CEO, Architecting Connected Systems Blog Twitter

    Wednesday, January 30, 2013 5:07 AM
  • Exactly what I did... unfortunately I have too few points so I´m not allowed to post URLs and the SQL have URLs due the XML namespaces...

    Just a  quote; using:

    .../text())[1] with ""')

    instead the Moontear approach:

    .../text())[1] with "workflow@example.org"')

    will take SP Email REST service to discard the null value it becomes and use the address configured in central administration. That makes more sense to me since you don´t need to use this query more than once.

    Thanks Moontear! I also like to stand the quote:

    Be aware: This is unsupported by Microsoft an might be changed (hopefully) in a future release. Changes in the DB are not supported and you might break your workflow service so you have to reinstall.

    Thursday, January 31, 2013 5:31 PM
  • This was actually fixed in the SharePoint 2013 March PU, the engine now must resolve a user from the email and if it doesn't, it will send as the outbound email address configured in the CA.

    It will not send as workflow@noreply anymore unless that resolves to an actual user in the user profile service.

    Be aware that when you install the March PU, any VS workflows will need to be re-worked as some of the namespaces changed. I am not sure about designer (SPD) workflows.

    Saturday, April 27, 2013 1:39 AM
  • Thanks for getting back to us Westley. Great that this nuisance is fixed!
    Sunday, April 28, 2013 9:11 AM
  • Dennis, thanks, work for me! 

    Regards, Artem

    Wednesday, May 14, 2014 10:07 AM
  • Worked perfectly for me many many thanks
    • Proposed as answer by Tomb_65 Thursday, June 12, 2014 3:17 PM
    • Unproposed as answer by Tomb_65 Thursday, June 12, 2014 3:17 PM
    Thursday, June 12, 2014 3:17 PM