質問

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