cygwin中的Ruby Outlook自动化

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cygwin中的Ruby Outlook自动化相关的知识,希望对你有一定的参考价值。

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

以上是关于cygwin中的Ruby Outlook自动化的主要内容,如果未能解决你的问题,请参考以下文章