Airmail
Incoming Email Router. Bringing you from SMTP text format straight through routing to a ruby controller. This project is looking to give you the tools to classify and handle incoming emails.
Set up routes, much like you would in Ruby on Rails. Perhaps in /config/mail_routes.rb?
Airmail.route do
deliver AttachmentController if
deliver DefaultEmailController
end
A controller can look like:
class DefaultEmailController < Airmail::Controller
def receive
logger.info("Email '#{subject}' received from #{from}")
end
end
Then receive emails!
mail = "FROM: [email protected]\nTO: [email protected]\nSubject: This is a great email!\n\nThis is the body.\n"
Airmail.receive( mail )
There is a poor man's implementation of a "sentiment analyzer." You can make some fuzzy logic to figure out some actions. For instance if you wanted "action [email protected]" to do trigger some "action."
Airmail.route do
deliver SomeActionController if sentiment "action", Airmail::EMAIL_PATTERN
end