我需要一种模式来处理传入的电子邮件。
我目前的伪代码是这样的:
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 ...
...
所以,我最终得到了一个有数千行的猪函数。
我怎样才能让这件事变得更简单?
提前致谢