Return to Snippet

Revision: 9290
at October 29, 2008 08:47 by narkisr


Updated Code
#!/usr/bin/ruby
require 'win32ole'
f = IO.popen("cygpath -w "+ARGV[1].to_s)
path= f.gets.strip
outlook = WIN32OLE.new('Outlook.Application')
message = outlook.CreateItem(0)
message.Subject = 'see attached file'
message.Body = ''
message.To = ARGV[0]
message.Attachments.Add(path, 1)
message.Send

Revision: 9289
at October 29, 2008 05:36 by narkisr


Updated Code
require 'win32ole'
outlook = WIN32OLE.new('Outlook.Application')
message = outlook.CreateItem(0)
message.Subject = 'Subject line here'
message.Body = 'This is the body of your message.'
message.To = '[email protected]'
message.Attachments.Add('c:\my_folder\my_file.txt', 1)
message.Send

Revision: 9288
at October 28, 2008 18:16 by narkisr


Initial Code
require 'win32ole'
outlook = CreateObject('Outlook.Application')
message = outlook.CreateItem(0)
message.Subject = 'Subject line here'
message.Body = 'This is the body of your message.'
message.To = '[email protected]'
message.Attachments.Add('c:\my_folder\my_file.txt', 1)
message.Send

Initial URL


Initial Description
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.

Initial Title
Ruby Outlook automation in cygwin

Initial Tags
ruby

Initial Language
Ruby