0

Is it possible (via VBA or other method) to apply a rule (eg. 'Move Email to Folder X') to an email based just on text in an attachment on that email.

I receive emails with XML attachments manually open them to find a specific date inside. I then file the emails into different folders based on this date.

I wpuld like to automate this process. The XML file has a field called 1/1/2013 . I would like the macro to open this attachment/ extract the date value / close the attachment, then move the email into a folder based on that date. (nothing too fancy...eg, I will initially create 12 folders based on each month)

I successfully use built in 'Rules' when the email body has the text I use to sort, but I need something specifically for attachments.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Marcus C
  • 169
  • 1
  • 2
  • 13

1 Answers1

0

Yes you can, KB 306108 has a sample script which can be run as a rule action (where you can do further processing).

James Snell
  • 604
  • 4
  • 13
  • that link seems to be broken.I'm getting a 'runtime error' paeg when I try open it. Not sure if it's a stackoverfow issue or an incorrect link. Can you check it ? cheers - Marcus – Marcus C Jan 21 '13 at 09:54
  • The link is http://support.microsoft.com/kb/306108 and I just checked it and it's ok from here. – James Snell Jan 21 '13 at 15:44
  • Thanks @James-snell . When I click the link or paste it into internet explorer, it returns an error. However, it opens fine in Chrome!! My question was more directed towards using data in an attachment to apply to a rule. I can create the basic rules through vba already. I need the code/tips on extracting info thats in an attachment on an email. – Marcus C Jan 21 '13 at 17:07
  • That sounds weird as I use IE (chrome is blocked on this machine, which is harder to do than it sounds given its attempts to bypass code/data separation...) But anyway, Item has an Attachments collection which you can then save the attachment to a file and process as normal. I'll do you an edit with a sample. – James Snell Jan 21 '13 at 19:49