tags:

views:

114

answers:

1

I am trying to incorporate this script here (http://snippets.dzone.com/posts/show/7530), yet i'm no ruby wizard. Right now it pulls down mail that I want with the local_file name, but was wondering if its possible to have it pull it down and save it by the 'message subject title + date of message'. When I try using mail.date, I get a longer than normal string, and can't convert it with Time.parse().

For instance, right now it pulls down an attachment as 103134.htm, which has no significance to me, and I'd rather have it be "Logs from Blah - 11/12/2009.htm" since it pulls the subject and date from the original message instead of the attachment local_name.

Any help would be greatly appreciated!

Thanks!

A: 

mail.date already returns a Time object, so it is not required that you parse it again. Instead use mail.date.strftime("%m/%d/%Y") to get your desired output

Brandon Bodnár