Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Automating Outlook with Ruby: Sending Email (See related posts)

From the Ruby on Windows blog.

Here's an example of how to use Win32 OLE/COM automation to create and send an email message with Microsoft Outlook.
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 = 'ted.williams@redsox.com'
message.Attachments.Add('c:\my_folder\my_file.txt', 1)
message.Send

Further details can be found here.


You need to create an account or log in to post comments to this site.


Click here to browse all 5147 code snippets

Related Posts