سؤال

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