Rule Engine - Bind to specific model

Posted 1 month ago by oliverbusk

I am currently trying to create a web application, that saves inbound emails. I have figured out how to save the incoming emails into my database, and I have all the email information available (headers, body etc.)

I want to be able to allow my users to set custom conditions for each of the email inboxes they have. So image user A have three inboxes. User A decides that for Inbox 1, below rule should apply:

Mockup

Meaning that the script, in this case, should:

  1. Check that the subject contains the word "Welcome!"
  2. Check that the From message does not contain the word "@hotmail.com"

Now I know I can just write a "simple" ifstatement, but this will not solve my problem, as I need it to be:

  1. Dynamic
  2. Specific for the given inbox

I am not sure how to go around this. I have found this project hoaproject/Ruler which seems to be suiting my needs in regards to writing "complex, dynamic" rules.

However, how would I go about implementing this dynamically?

As said, I want my users to be able to set rules that are specific for their own mailboxes.

Should these rules be saved in a database?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.