web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Change email To and CC...
Power Automate
Suggested Answer

Change email To and CC based on environment

(0) ShareShare
ReportReport
Posted on by
I was wondering if there was an easy way to prevent emails being sent (or change who they are sent to) based on the current environment. I have dev, test, and prod environments and want the dev and test to not send emails. I tried deactivating the Exchange Online server profile in the admin centre, but it has had no effect. 
Categories:
I have the same question (0)
  • Suggested answer
    Vahid Ghafarpour Profile Picture
    817 on at
    I think deactivating the Exchange Online server profile has no effect because Business Central uses Email Scenarios and Communication Profiles to send emails, which can bypass or override the server profile status.

    https://www.youtube.com/watch?v=L-URlEnm2t0
  • CU27030035-0 Profile Picture
    105 on at
    If your flow is part of a solution you can use environmental variables to change values based on environments 
     
  • Suggested answer
    deepakmehta13a Profile Picture
    369 on at
    Hi,
     
    This is a common requirement when working across Dev, Test, and Prod environments, and disabling the Exchange profile won’t stop emails triggered via Power Automate or connectors.
     
    What’s happening:
    Power Automate flows send emails using their own connections (like Office 365 Outlook), which are independent of the Exchange server profile settings in the environment. That’s why deactivating the profile has no effect.
     
    How to handle this properly:
    1. Use environment-based conditions (recommended)  
    Add a condition in your flow to check the current environment and control email behavior.
    You can:
    - Store the environment name in an Environment Variable  
    - Or use a variable/config table to identify Dev/Test/Prod  
    Then:
    - If Dev/Test → skip sending email OR send to a test mailbox  
    - If Prod → send to actual recipients  
     
    2. Use Environment Variables for recipients  
    Create Environment Variables like:
    - Email_To  
    - Email_CC  
    Set different values per environment:
    - Dev/Test → your email or dummy mailbox  
    - Prod → real users  
    Then reference these variables in your email action.
     
    3. Use a toggle flag (safe approach)  
    Create a variable like:
    SendEmails = Yes/No  
    - Dev/Test → No  
    - Prod → Yes  
    Add a condition before email action:
    Only send when SendEmails = Yes  
     
    Suggested approach:
    Best practice is to combine:
    - Environment Variables (for recipients)  
    - A condition/toggle (to enable/disable emails)  
     
    This gives you full control without changing the flow logic every time.
     
    Hope this helps,
    If this helps resolve your issue, please consider marking the response as Verified so it can help others facing a similar scenario.
    If you found this helpful, you can also click “Yes” on “Was this reply helpful?” or give it a Like.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard