From: Joel Pearson Date: 2013-03-09T17:09:11+09:00 Subject: Re: Question regarding automating some Outlook/IMAP and pdf parsing functions w/ ruby? I ran this on Office 2010 Outlook, what version are you using and what exactly was the error message? These are the bits you'd probably want to customise: /@exampledomain.com$/i This is a Regular Expression. The "i" means ignore case. The "$" means at the end of a line ("\z" would be end of the string and would also work). folder = "#{ ENV['USERPROFILE'] }\\example" This is the destination folder. You could add another "\\subfolder" for each group of attachments if you want as well. special_text = msg.body.scan( /^[a-z]{10}/i )[0] This Regular Expression extracts text from the email matching a pattern: in this case the first 10 a-z characters on the start of a line without spaces or other characters in. It will be blank if it doesn't find anything, but you could change it to whatever text pattern you want to extract. See http://www.rubular.com/ to experiment with Regex. filename = "#{ folder }\\#{ special_text }#{ index }#{ att.filename }" This is the one where you determine what you file is called and where it will go. I've decided to give them each a unique name by adding the main folder, the content we pulled from the email, an index so it's a unique name, and the original filename as well. You can customise this however you like. filenames << ( filename = ... At this point I'm collecting all the filenames together in case I want to report them back or do something else with them. It isn't used in the example but you could then do something else with this array. Let me know if there's any further clarification you need. I haven't looked into calender appointments, but I think there are a few examples of doing this online, and you now have an interface with Outlook to play with. -- Posted via http://www.ruby-forum.com/.