-2

as the topic says, I want to redirect an incoming mail to a rubyscript. I know i can pass the mail via |path/to/script to a script, but i have no idea how to work with the input in ruby...

Hope someone could show me the right direction.

thanks

freg
  • 133
  • 1
  • 8
  • rails or just plain ruby ? – Doon May 13 '13 at 18:36
  • This question is off topic, because it doesn't relate to *code* or *programming* directly. You may want to ask over at [Super User](http://superuser.com/), and when you do, make sure you specify what e-mail server, and environment. – Jesse May 13 '13 at 18:54

1 Answers1

0

You can use the mail gem (https://github.com/mikel/mail) to read emails. Just grab it from stdin, and then pass it in.

 #!/usr/bin/env ruby
 require 'mail'

 message = $stdin.read 
 mail = Mail.new(message)

 ... work with the Mail here .. 

The documentation on the github is pretty good.

Doon
  • 19,719
  • 3
  • 40
  • 44