문제

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