WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Muliple email messages based on subfolder? (Read 3301 times)
dbortunk
YaBB Newbies
*
Offline



Posts: 2
Muliple email messages based on subfolder?
Mar 23rd, 2009 at 10:09pm
 
Is it possible to have multiple email subject lines or bodies based on subfolder? I have 9 subfolders in every root folder and the subject needs to be different depending on which folder the file is dropped into. Is this possible without creating a task for each folder?
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Muliple email messages based on subfolder?
Reply #1 - Mar 24th, 2009 at 9:38am
 
Hi,

There are 2 ways for that. The easiest, but maybe a bit more work, is to use the "SubTask" plugin:
http://www.watchdirectory.net/wdhelp/plugins/wdopMultiPlugin.html
Configure multiple email subtasks, and use a proper "mask" so only one of them will run for detected files.
So, the mask for Subtask 1 could be "*\Subdir1\*", Subtask2 would have "*\Subdir2\*".

Another way to do this (here you can only make the subject and recipients depend on the subdir) is to use files with email addresses as described here:
http://www.watchdirectory.net/wdhelp/plugins/email_addressing.html
One undocumented feature of those files is that you can change the subject there. At the bottom (after the email addresses) enter the following 3 lines:

[subject]
subject=The subject I want to use


Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
dbortunk
YaBB Newbies
*
Offline



Posts: 2
Re: Muliple email messages based on subfolder?
Reply #2 - Mar 24th, 2009 at 6:08pm
 
right but what happens in the case you have something like this

Root Folder
  Vendor1
     Folder1
     Folder2
     Folder3
  Vendor2
     Folder1
     Folder2
     Folder3

So I want it to monitor the root folder for any files placed in subfolders (Files are only placed in folder1, 2 ,3 in each vendors folders). Then based on the vendor subfolder that the file is dropped into, send an email specific to that vendor (which is where the customized subject line comes into play). I understand how you could do it if you are monitoring the folders in the inside like folder1 can this be done without creating a task for each vendor?
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Muliple email messages based on subfolder?
Reply #3 - Mar 25th, 2009 at 7:52am
 
Yes, that can be done.
first method
If you use the first method (using the subtask plugin), you would let the task (this is not the same as the subtask) monitor
C:\Root Folder
including sub-directories.
Now create 2 SubTasks, both using the email plugin. For each subtask you have 100% control over the recipient, subject and message body. The "trick" is to enter vendor specific masks ("only run this subtask for files matching") on the subtask settings - http://www.watchdirectory.net/wdhelp/plugins/wdopMultiPlugin_subtask_settings.ht... ).

So in your case, Subtask1 would use
*\Vendor1\*
(that would match all files having "vendor1" somewhere in their complete pathname).
Subtask2 uses
*\Vendor2\*

second method
create a task (email plugin) that monitors
C:\Root Folder
including sub-directories.

Inside the "Send Email To" box, do NOT enter an email address, but enter
@@!email.txt
(at at exclamation mark)
This tells the task to look for a file with email addresses called email.txt in the same directory where the newly detected file is found. If this file is not found there, the task will look one directory higher (all explained here: http://www.watchdirectory.net/wdhelp/plugins/email_addressing.html ).

Now create the file "C:\Root Folder\Vendor1\email.txt" using notepad. Enter the following lines:
Code:
TO:John Doe<john@home.com>
CC:<me@home.com>
[subject]
subject=Hello Vendor 1!
 



Likewise create the file "C:\Root Folder\Vendor2\email.txt"

what method to use
The first method (using subtasks) gives you most flexibility. You can have a different message body, for example. The second method (advanced addressing using @@!email.txt)  is fastest to setup.

At runtime there is no real difference in performance as both these methods use one "new file detection" engine.

Does this better explain?
Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1