WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> Plugins >> Email Task Description variable
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1268240708

Message started by YorkieBar on Mar 10th, 2010 at 6:05pm

Title: Email Task Description variable
Post by YorkieBar on Mar 10th, 2010 at 6:05pm
I'm using the %WD_CONFIG% variable in emails but would like to include more user friendly information about the contents of the email.

Is the short description entered on the last tab available as a variable?

Title: Re: Email Task Description variable
Post by Gert on Mar 11th, 2010 at 7:33am
Hi,

It is not available, currently. Also, I hesitate to add it because this is a multiline field. The %WD_xxx% variables are also used for Batch scripts and this can cause problems in those scripts....

An alternative you can use (see http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv.html ):
add this to your email body:

[code]@@@C:\BodyTexts\%WD_CONFIG%.txt@@@[/code]

(see "Enter the message body" on http://www.watchdirectory.net/wdhelp/plugins/wdopAutoEmail.html )

and create text files in C:\BodyTexts with the text you want to include. Note that those texts should be stored on a local drive (C:), not on the network.

Gert

Title: Re: Email Task Description variable
Post by Gert on Mar 11th, 2010 at 9:47am
You can even do

[code]@@@C:\BodyTexts\%WD_CONFIG%_%WD_REASON%.txt@@@[/code]

where WD_REASON is replaced by FILENEW, FILECHNG etc. So you have different texts depending on the event.

Title: Re: Email Task Description variable
Post by YorkieBar on Mar 11th, 2010 at 9:52am
Part of what I'm trying to do is to reduce the 6 email tasks I currently have to a single job so would prefer the BodyText file to be in the same directory as the files to be emailed.The %WD_CONFIG% is therefore the same name for each email.
I have the @@email.txt file in a unique directory on the server for each type of message already. It would keep the data in one place and make maintenance easier if the BodyText file was there as well.

Title: Re: Email Task Description variable
Post by Gert on Mar 11th, 2010 at 10:01am
Here is one little secret (it should probably be documented).

If you use the @@email.txt trick (see Advanced Addressing at http://www.watchdirectory.net/wdhelp/plugins/email_addressing.html ), you can also add a subject (not message body) to the email.txt. This subject will be used instead of the subject you configured for the email task.

To get a subject based on the directory where the files are detected, add the following 2 lines at the bottom (!!!!!!!) of the list of email addresses:

Code (][subject):
subject=My subject for those recipients


Again, please make sure the above 2 lines are at the bottom of the file.

Title: Re: Email Task Description variable
Post by YorkieBar on Mar 11th, 2010 at 10:59am
Are variables allowed in this subject line?
Also - Could an option for the future be adding Body Text lines here as well?

Title: Re: Email Task Description variable
Post by Gert on Mar 11th, 2010 at 11:10am
Currently not (variables and body text).

But both are good ideas, I will add them to our "to do/to investigate" list.

Gert

Title: Re: Email Task Description variable
Post by YorkieBar on Mar 11th, 2010 at 12:01pm
Two new files similar to @@email.txt

e.g. @@subject.txt and @@bodytext.txt

both allowing full use of the existing WD variables would suit my needs.

Thank for the help - I'll leave my plan to consolidate email tasks into one until another time.

Title: Re: Email Task Description variable
Post by Gert on Mar 11th, 2010 at 12:13pm
mmmm, that won't work.
"email.txt" is just an example filename, it could be anything (including subject.txt etcetera, email.txt is just an example name).

Ok, the subject is already configurable, described above.

[blackmail mode on]
If you help my friend Vladimir who is looking for help for a friends' son with cancer, I will make sure you can also include body-text in "email.txt" in the next release. Not sure if I can include variables, I will check if it is easy to include. For Vladimir's quest, please see:
http://www.datalandsoftware.com/blog/2010/02/28/please-help-little-andrew-and-get-a-free-license/
and
http://watchdirftp.blogspot.com/2010/02/do-you-want-to-help-little-boy-with.html
and
http://watchdirftp-de.blogspot.com/2010/03/25-rabatt-fur-eine-kleine-spende.html
[blackmail mode off]

Gert

Title: Re: Email Task Description variable
Post by Gert on Mar 11th, 2010 at 12:46pm
Paul understands how to influence our release schedule ;-)

Thank you for your help for little Andrej, Paul.

I better start my editor/compiler now.

Gert
http://watchdirftp.blogspot.com/2010/02/do-you-want-to-help-little-boy-with.html

Title: Re: Email Task Description variable
Post by Gert on Mar 14th, 2010 at 4:26pm
Just released version 4.6.2 which allows you to "override" the subject and message body:

http://www.watchdirectory.net/wdhelp/help/wdcc_version_history.html

Title: Re: Email Task Description variable
Post by YorkieBar on Mar 18th, 2010 at 1:44pm
Thanks Gert  :)  The new option works very well.
I'm using it to monitor 10 main directories and a 4 level deep set of dynamic named sub directories.
Whereever I need a special set of addresses and/or subjects I place an @@email.txt file in the actual lowest level directory.
Alternatively using the ability to look upwards through the tree (using @@!email.txt) I now have personalised sender addresses etc set in higher/middle :) level directories. This enables me to use dynamic naming to create directories and still send personalised emails.
I have a final top level default @@email.txt file that sends me the email message, this enables me to trap any missing @@email.txt in lower directories.

Its another great WD function.

:)

Title: Re: Email Task Description variable
Post by Gert on Mar 18th, 2010 at 2:05pm
Yeah, when I sometimes visit customers (or get a support request), I am often amazed how many email tasks they have running. I guess advanced addressing is not obvious enough. I wrote a blog earlier ( http://watchdirftp.blogspot.com/2009/05/how-many-tasks-does-watchdirectory.html ) trying to explain a bit better.

Hey, being the nice guy you are ;-)
Would you be interested to write a guest blogpost, describing how you use WD and, especially, the email feature? I think your experience will be a great read for other people.

Let me know (and I totally understand if you don't have time to do so),
Gert

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.