Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Sending emails in multiple environments in the Cloud.

(0) ShareShare
ReportReport
Posted on by

We have a model driven application that sends out emails via a central email account with workflows and/or FLOWs.

We need to move that app through multiple environments in the SDLC (DEV, TEST, STAGE, PROD) in the Government Cloud.

Microsoft is saying that we can only have the OUTGOING email address active in ONE environment at a time (previously, this was only an issue for INCOMING email).  They've changed this to accomodate conversation indexing, etc on outgoing email.

This seems to be a violation of the SDLC - as we would have to manually change the User that sends the email in each environment as we move the code through it.  That would invalidate any testing done in the previous environment, and would require a regression test in every environment.  Possible for a full DevOps pipeline, but we aren't there yet.

Does anyone have a good process for handling this that doesn't involve manually changing Users, workflow owners, etc?

  • Suggested answer
    Linn Zaw Win Profile Picture
    3,407 on at
    RE: Sending emails in multiple environments in the Cloud.

    Here's the example of Dev and UAT.

    Create a queue in Dev with the Dev specific mailbox email address (e.g. Website.Enquiries.DEV@contoso.com).

    Then, create the queue with the same GUID in UAT by exporting/importing using Data Import Wizard

    1. Export the queue from Dev from Advanced Find

    • Remove unnecessary columns
    • Rename the GUID column name to Queue
    • Save the file as .csv

    pastedimage1593122759722v2.png

    2. Import the .csv file from step 1 above in UAT

    • Map the columns
    • Map Queue to Queue (Primary Key)
    • Update the Incoming Email to UAT specific mailbox (e.g. Website.Enquiries.UAT@contoso.com)

    You can use other tools such as Configuration Migration tool or Data Transporter in XrmToolbox to migrate the records with same GUID too.

    pastedimage1593122812837v3.png

    The outcome is the Queue record in two different environments with the same GUID as in the same screenshot below.

    pastedimage1593122291537v1.png

    Once you have Queue record with the same GUID across all environments, you can configure that Queue as the sender of the automated email in the workflow.

    When your workflow is deployed from Dev to UAT, you don't have to manually update the sender after deployment because it is referencing to the Queue record with the same GUID. And the workflow will send an email from the Dev specific mailbox when you test in Dev and UAT specific mailbox when you test in UAT. (and so on)

    pastedimage1593123266889v4.png

    For flow, you can either hardcode the GUID of the Queue or retrieve dynamically with the name before setting as the sender of the mailbox (check out the step 3 and 4 in my blog post).

    pastedimage1593123785748v5.png

  • Community Member Profile Picture
    on at
    RE: Sending emails in multiple environments in the Cloud.

    Hi Linn,

    I wonder if you could take the time to expand upon this a bit more?  This is exactly what I am looking for.

  • Linn Zaw Win Profile Picture
    3,407 on at
    RE: Sending emails in multiple environments in the Cloud.

    In the projects that I work on, we normally create a Queue for those types of incoming/outgoing mailboxes to be configured in the workflows/flows. (and do not use a User record)

    We create the Queue in Dev and push it to the higher environments create with the same GUID. (by using Data Import Wizard with GUID in the import template or Configuration Migration tool or Data Transporter in XrmToolbox.

    Once we have created the Queue with the same GUID, we update the email address to each corresponding environment mailbox (e.g. contactus@contoso.com, contactus.uat@contoso.com, contactus.test@contoso.com)

    In that way, the solution components can be safely deployed without manually changing the reference data in the solution components.

    This is not only the case for the mailbox, we also follow the same procedure for the reference data. (e.g. The Case Type is the lookup to the reference data and the workflow condition is based on the Case Type = "XYZ") We make sure all those reference data used in the solution components are created with the same GUID in all environments.

  • OmarZaarour Profile Picture
    1,705 on at
    RE: Sending emails in multiple environments in the Cloud.

    Understood. Do you have the option of moving to flow for all your email needs? In this way, you can check the environment host where the flow is running (Dev or test or prod) and based on that condition, you can branch to send the email using different from fields. This way, you can have 3 mailboxes, one for each environment and each is enabled only in its respective environment.

  • Community Member Profile Picture
    on at
    RE: Sending emails in multiple environments in the Cloud.

    Hi Omar, thanks for answering.  

    This is a Federal Government agency, so they want to do an end to end test in every environment.  That, unfortunately, includes sending emails through Exchange.  Seeing the pending message in the email messages entity is not enough.  We are having discussions around testing in just ONE sandbox environment (like TEST), and then in Production. That would entail temporarily disabling in Production to test in TEST, then re-enabling after all tests are completed.

    If it were up to me, I'd do exactly what you are suggesting.  Seems simple to me.

  • OmarZaarour Profile Picture
    1,705 on at
    RE: Sending emails in multiple environments in the Cloud.

    Hello Bill,

    Advocating for simplicity here,  the way I used to work with this is keep the user the same but don't enable the mailbox except in production. In CRM, you would have an activity created for the email and that's enough for testing in dev/test environments. Once the activity is created , it will stay in a pending state and it will never be sent because no mailbox is enabled. In production on the other hand and because the mailbox is enabled, the email will be sent.

    With Flows, make sure to create those email activities and attach them to the record as well for email-tracking purposes.

    In your case, is the sending of the actual email something you can't live without?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#2
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 53 Super User 2025 Season 1

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 32 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans