Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top