Ruby Outlook automation in cygwin


/ Published in: Ruby
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.