title: c# auto processing email according to rules
body: <p>I need a pattern for processing incoming emails.</p>
  
  <p>My current pseudo-code is like this:</p>
  
  <pre><code>if sender is a@a.com and messageBody contains "aaa" then
     extract the content according the aaa function
     save it to database
     move the message to the archive
  else if messageBody contains "bbb" then
     extract the content according to bbb function
     save it to database
     inform sender
     move the message to archive
  else if messageBody NOT contains "ccc" and from "sender@ccc.com" and then
     leave message in the inbox so the it will be manually processed
  else if ...
     ...
  </code></pre>
  
  <p>So, I ended up with a pig function with thousands of lines.</p>
  
  <p>How can I make this thing simpler?</p>
  
  <p>Thanks in advance</p>