开发者

Smart email reading

开发者 https://www.devze.com 2023-03-05 14:58 出处:网络
I am working on a erp system, being developed using Ruby on Rails. I want to create a sales order by reading the contents of the email. I can recognize by reading the contents if its a sales order or

I am working on a erp system, being developed using Ruby on Rails. I want to create a sales order by reading the contents of the email. I can recognize by reading the contents if its a sales order or inquiry.

Now a step forward I want to read email and fetch the items in the list. I am planning to take words from the email and search them in the database under items. I can't fix a certain format for the email.

I am going to use following approach. I'll be using ferret(initially, may switch to sphinx or similar) to search the items in the emails content.

1). Loop through items table and search them for开发者_如何学运维 exact phrase match. Email.find_with_ferret("item+name")

2). Search email for item name split keyword. Email.find_with_ferret("items nice name")

3). Fuzzy search Email.find_with_ferret("items nice name~")

Please help me to improve this.


You're going to need to intercept the emails with rails. Here's a decent article explaining the various approaches to doing this:

http://steve.dynedge.co.uk/2010/09/07/incoming-email-in-rails-3-choosing-the-right-approach/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号