Ruby script to read output from alias
I have an alias in /etc/aliases
, so every time an email arrives at a specific address, the body of the email is sent to a Ruby script. For instance:
example: |/etc/smrsh/my_script.rb
I need to know how to read pipe data in my Ruby script. I wrote a simple Perl script that can read data. I just can't figure out how to do this in Ruby.
Here are the relevant lines in the Perl script:
my $fout = "/tmp/email.out";
open( EM, ">$fout" );
while( <> ) {
chomp;
print EM "$_\n";
}
0
Jason palmer
a source
to share