J
Johann Spies
A few years after my first contact with ruby (and not using it) I am
like a newbie again.
I want to use a ruby script to add a disclaimer to a message passed to
it by exim.
So far I can add a disclaimer to a message file by the following
script:
=============================
#!/usr/bin/ruby
require 'tmail'
mail = TMail::Mail.load( ARGV[0])
disklymer = "\n\nDit is 'n aangeplakte disklymer hierdie... \n"
if not mail.key?("X-Disclaimer") then
mail.[]=("X-Disclaimer","added")
if mail.multipart? then
mail.preamble += disklymer
else
mail.body += disklymer
end
end
puts mail.encoded
==============================
But when exim calls the script the message is not saved in a temporary
file. The script should thus be able to handle a message passed to it
like in the following command:
cat <email-message> | disclaimerscript.rb
I have experimented a little bit with "/usr/bin/ruby -n" and $_ but I
did not have success.
I would appreciate some help with this one please.
Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"Therefore being justified by faith, we have peace with
God through our Lord Jesus Christ." Romans 5:1
like a newbie again.
I want to use a ruby script to add a disclaimer to a message passed to
it by exim.
So far I can add a disclaimer to a message file by the following
script:
=============================
#!/usr/bin/ruby
require 'tmail'
mail = TMail::Mail.load( ARGV[0])
disklymer = "\n\nDit is 'n aangeplakte disklymer hierdie... \n"
if not mail.key?("X-Disclaimer") then
mail.[]=("X-Disclaimer","added")
if mail.multipart? then
mail.preamble += disklymer
else
mail.body += disklymer
end
end
puts mail.encoded
==============================
But when exim calls the script the message is not saved in a temporary
file. The script should thus be able to handle a message passed to it
like in the following command:
cat <email-message> | disclaimerscript.rb
I have experimented a little bit with "/usr/bin/ruby -n" and $_ but I
did not have success.
I would appreciate some help with this one please.
Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"Therefore being justified by faith, we have peace with
God through our Lord Jesus Christ." Romans 5:1