From: "R.. Kumar 1.9.1 OSX" Date: 2010-07-06T16:46:22+09:00 Subject: Re: editing text using $EDITOR from program R.. Kumar 1.9.1 OSX wrote: > > However, since "mail -s" requires both input, as well as some command > line parameters (title and emailid), i was not clear whether this method > would work. > > thx. This works: def pipe_output (str) pipeto = %q{mail -s "a title" myemail } if pipeto != nil # i was taking pipeto from a hash, so checking proc = IO.popen(pipeto, "w+") proc.puts str proc.close_write #puts proc.gets end end str = "this is some data to go in mail" pipe_output str Not sure which is cleaner and more reliable though, this way or: cmd = %q{cat file.txt | mail -s "title" email} system(cmd) -- Posted via http://www.ruby-forum.com/.