mail = Mail.read( ARGF.filename )
p mail.attachments[0].filename
I have a text file that is an email with base64 encoded attachment and if I do this:
tmail.rb email.txt
- the script runs correctly with no errors but if I do this:
cat email.txt | temail.rb
I get:
/usr/share/gems/gems/mail-2.6.3/lib/mail/mail.rb:176:in `initialize': No such file or directory @ rb_sysopen - - (Errno::ENOENT)
from /usr/share/gems/gems/mail-2.6.3/lib/mail/mail.rb:176:in `open'
from /usr/share/gems/gems/mail-2.6.3/lib/mail/mail.rb:176:in `read'
from ./t010_1.rb:5:in `<main>'
ie "-" is not recognised as a legitimate file name - is there a way of (simply) doing what I want with pipes ie STDIN?