Outlook mail to agile from specific folders as the mail is received

Not open for further replies.


New Member
Outlook version
Outlook 2010 32 bit
Email Account
Hello all, I need to write some code to automatically send specific files from specific folders to a file. I have reviewed the code for sending all the files as they are received however I can't detect the folder names in that code. Not all the folders need to be written. The idea is we have account managers with many clients, ideally we need to write the mails automatically from specific folders as they are received. All the code I found sets the default directory and writes all the mail, no way to define the folder where the mail was received. Any help would be greatly appreciated. VBA code samples please.
Where will the folder names come from? If there is no easy way to detect the folder path to use from the message, its going to be hard to automate it.

This macro files by sender name, creating the folder if it doesn't exist: http://www.slipstick.com/developer/file-messages-senders-name/ it can easily be tweaked to use domain or email address. I have a newer example here that creates a folder based on this week's date and creates a rule to file mail - but like the first macro, the paths were easy to define.

Thanks for your response, maybe I can be a little clearer with my intentions. I was approached by a user that is having storage issues and want to copy emails to a network share Drive (File, MSG Format). I have been able to copy every email received in the default inbox, but that is not their requirements. Each of my users have many clients and they manage their communications by creating and managing folders for each client. The idea was to define the folder path (can be done but only one path in the "ThisOutlookSession") and every file received write it to a network share for Archiving purposes. I have scoured for days and have not been able to find an automated way of archiving (mail MSG copy to a File) for specific folder anywhere. Maybe I can take another approach, maybe setting flags on mails I have already moved might work. I would not want to duplicate the mails after writing to a file. I would want to flag as I write the files as not to create duplication. Of course all of this needs to be done automatically, I can't rely on the user to execute macros. Any Ideas? Of course the custom macro would have the hard coded paths of the file directories needed to Archive mails, that is expected, but if possible one time set up and the system takes over from there. Using a timer control to run every 60 minutes, maybe. I am using Outlook 2010.
That helps to clarify things. The mailboxes have multiple folders that need to be checked? I don't have any code samples handy, but you could match the folder names - if a message is in MyStuff, a MyStuff folder is created in the share. You can either set a field or category to identify already saved items or include the received time in the file name and skip if the file exists. Another option is watching all incoming and outgoing mail and saving it at that point. It would be easier as you don't have to walk the folders looking for new mail. It doesn't work as well if you use server side rules as the script will miss mail moved on the server.

There are applications available that can do this sort of thing already - and they generally have a good ROI. By the time you figure in the cost of creating a solution, testing it and installing it on multiple computers, the 3rd party solution looks like a bargain (so does increasing the mailbox size :)). If you have many users, you should create an addin and sign it with a digital certificate - installing vba on each work station is time consuming.
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Limited Support for 3rd Party Mail in new Outlook? Using Outlook 1
K How can I delete an e-mail from Outlook Using Outlook 1
e_a_g_l_e_p_i MY Outlook 2021 changed the format of the shortcuts for mail, calendar etc. Using Outlook 10
D Gmail mail is being delivered to a different email inbox in Outlook App 2021 Using Outlook 2
D Outlook 2003 Mail Fails Using Outlook 1
P Importing other e-mail accounts into Outlook Using Outlook 1
F Excel VBA to move mails for outlook 365 on secondary mail account Outlook VBA and Custom Forms 1
M Convertor for Outlook Express Mail Store (.dbx) to Outlook Mail Store (.pst) Using Outlook 0
T Outlook creates a copie of every mail I send Using Outlook.com accounts in Outlook 4
M Outlook 2010 How could I globally redesign an outlook template form/region/inspector template used to display mail lists or an individual mails? Outlook VBA and Custom Forms 0
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
R How to Sync *all* Google Workspace Mail Folders with Outlook 2019 (MS365) Using Outlook 3
S Outlook VBA How to adapt this code for using in a different Mail Inbox Outlook VBA and Custom Forms 0
S Outlook email to configure setup for each mail Outlook VBA and Custom Forms 1
S Outlook mail adressing stops after first match in GAL Using Outlook 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
ThinkToday Calculate reply time of outlook mail Using Outlook 1
GregS Why is Outlook 2016 mail in Outlook.com? Using Outlook 1
S Outlook not receiving mail Using Outlook 1
Commodore Outlook (2013) issues with icloud.com mail Using Outlook 0
GregS Outlook 2016 iPhone won't download Outlook 2016 Mail. Using Outlook 0
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
H In outlook 365 POP mail Inbox, email takes a long time or never arrives. Using Outlook 1
B Outlook - Mail from safe senders list being sent to Spam Folder Using Outlook 0
H Outlook 2016 sent over 30 copies of an e-mail with attachments Using Outlook 1
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
P when i move inbox mails to another folder in outlook the mail disappears Using Outlook 1
E Copy e-mail body from outlook and insert into excel Outlook VBA and Custom Forms 3
soadfan Outlook won't send e-mail when offline Outlook VBA and Custom Forms 19
M Duplicate Primary Mail Accounts outlook 2010 Using Outlook 0
H Custom autoforwarding, sending mail through outlook office 365 Using Outlook 1
J Copy or Export Outlook Mail to Excel Outlook VBA and Custom Forms 6
stephen li VBA Outlook send mail automatically by specified outlook mail box Outlook VBA and Custom Forms 1
T Changing default Mail Account in Outlook 2016 - POP3 Using Outlook 1
J Problem with Outlook 2016 new mail tray icon alert (envelope in the systems tray) Using Outlook.com accounts in Outlook 0
T Probem with junk mail folder in new account in Outlook Using Outlook 0
GregS Outlook mail arrives in batches, sometimes hours late Using Outlook 1
T outlook 2010 mail item count doesnt match display Outlook VBA and Custom Forms 3
T Outlook 2016 cannot connect after transition to Outlook Mail Using Outlook.com accounts in Outlook 4
N Outlook People Pane - Sent Mail Using Outlook 1
L pin to Outlook move mail Using Outlook 2
M Outlook Mail Using Outlook 3
Diane Poremsky Junk Mail Filtering in Outlook Using Outlook 0
I Collecting mail address from GAB and adding to Outlook Task Using Outlook 2
Diane Poremsky Internet Mail Issues with Outlook Using Outlook 0
Diane Poremsky Mail Issues with Outlook Using Outlook 0
Diane Poremsky Error Opening Outlook and Control Panel's Mail Applet Using Outlook 0
Diane Poremsky Outlook 2013: Control Panel Mail Won't Open Using Outlook 0
T Create Rule For Secondary E-Mail Address In Outlook 2016 Using Outlook 4

Similar threads