Posted By

narkisr on 10/28/08


Tagged

ruby cygwin automation Outlook


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

webstic
darkhawk


Ruby Outlook automation in cygwin


 / Published in: Ruby
 

Simple Outlook automation, the idea is to use this in cygwin to send files without opening the outlook UI, to use it place the code under /bin folder and make it executable with chmod +x.

  1. #!/usr/bin/ruby
  2. require 'win32ole'
  3. f = IO.popen("cygpath -w "+ARGV[1].to_s)
  4. path= f.gets.strip
  5. outlook = WIN32OLE.new('Outlook.Application')
  6. message = outlook.CreateItem(0)
  7. message.Subject = 'see attached file'
  8. message.Body = ''
  9. message.To = ARGV[0]
  10. message.Attachments.Add(path, 1)
  11. message.Send

Report this snippet  

You need to login to post a comment.