cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nhafala
Frequent Visitor

Auto email reply filter

I created a flow to send email replies. However, I noticed that microsoft flow repeatedly tries to send replies to non repliable addresses. To go around that problem, I added the following condition:

 

@or(not(contains(triggerBody()?['From'], 'noreply')),not(contains(triggerBody()?['From'], 'donotreply')),not(contains(triggerBody()?['From'], 'no-reply')),not(contains(triggerBody()?['From'], 'postmaster')))

f2MADK9

 

So if the email address does not contain any of those terms, the flow continues on to the next steps.

 

The problem is the code works for all included terms except "postmaster" and I can't figure out why.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-alzhan-msft
Community Support
Community Support

Hi @nhafala ,

 

I afraid that your expression is wrong,you should use the and function instead of the or function, the expression should as below:

@and(not(contains(triggerBody()?['From'], 'noreply')),not(contains(triggerBody()?['From'], 'donotreply')),not(contains(triggerBody()?['From'], 'no-reply')),not(contains(triggerBody()?['From'], 'postmaster')))

Please let me know if your problem could be solved.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
RezaDorrani
Dual Super User II
Dual Super User II

Hi @nhafala 

 

Your condition is correct

One caveat with contains is it is case sensitive

 

So if email is Postmaster then contains will return false since your are comparing with lower case postmaster

Try this if porblem is with case sensitivity

 

@or(not(contains(triggerBody()?['From'], 'noreply')),not(contains(triggerBody()?['From'], 'donotreply')),not(contains(triggerBody()?['From'], 'no-reply')),not(contains(toLower(triggerBody()?['From']), 'postmaster')))

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

v-alzhan-msft
Community Support
Community Support

Hi @nhafala ,

 

I afraid that your expression is wrong,you should use the and function instead of the or function, the expression should as below:

@and(not(contains(triggerBody()?['From'], 'noreply')),not(contains(triggerBody()?['From'], 'donotreply')),not(contains(triggerBody()?['From'], 'no-reply')),not(contains(triggerBody()?['From'], 'postmaster')))

Please let me know if your problem could be solved.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

WendyK
New Member

How do I translate this:

@and(not(contains(triggerBody()?['From'], 'noreply')),not(contains(triggerBody()?['From'], 'donotreply')),not(contains(triggerBody()?['From'], 'no-reply')),not(contains(triggerBody()?['From'], 'postmaster')))

To a statment in the folowing:

WendyK_0-1634812864719.png

Sorry mine is in dutch! I do not have avanced mode!

 

 

WendyK
New Member

I think I found it:

WendyK_0-1634814331694.png

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (3,387)