Summary Email Notification

8 views
Skip to first unread message

sskw...@gmail.com

unread,
Apr 5, 2010, 10:30:24 AM4/5/10
to RhinoSoft.com User Group
I've have been using the Event triggers in Serv-U v9.3.0.1 to send
emails for specific events i.e. Single File uploaded, Failed Login,
etc and they work satisfactory. But, I would like to send a summary
email for a specific session that encompasses all of the files
processed for a given sessions listing their names, sizes, etc.
Sending 100 emails for 100 files processed would cause my clients some
unneeded headaches and would most likely not want them at all.

Basically instead of an email for a single file transfer for a given
session, I would like a single email that encompasses all of the files
processed for a given session.

Does anyone have any experience with accomplishing this customization?

Thanks,
Steve

FTPServerTools

unread,
Apr 7, 2010, 6:35:41 PM4/7/10
to RhinoSoft.com User Group
Well it is a bit harder then the average thing but it can surely be
done.
I'll show you the basics.
First create the events you want to log e.g. File Uploaded with
Execute Command
c:\windows\system32\cmd.exe /c echo uploaded: $FileName >>c:\servu
\eventlogs\$FullName

Then when the user disconnects send the file over using blat.exe or
sendmail (http://glob.com.au/sendmail/)
c:\windows\system32\cmd.exe /c c:\servu\script\sendfile.cmd
"$FullName" "$UserEmailAddress"

Now sendfile.cmd is as follows:

ECHO From: m...@example.com >"c:\servu\eventlogs\temp\%1"
ECHO To: "%2" >>>"c:\servu\eventlogs\temp\%1"
ECHO Subject: Last transfers >>"c:\servu\eventlogs\temp\%1"
TYPE c:\servu\eventlogs\%1 >>"c:\servu\eventlogs\temp\%1"
ECHO . >>"c:\servu\eventlogs\temp\%1"
WaitAMoment 2000
del "c:\servu\eventlogs\temp\%1"
del "c:\servu\eventlogs\%1"

Be aware that this is an example, you could do it in php (running
php.exe), vbscript (running cscript.exe), jscript, windows shell, bsh
for windows, or whater your liking is for scripting. I just used basic
dumb cmd.exe here.
This is untested but with some fiddling it shoudl work fine.
This one has one drawback, the file created gets sent when the user is
disconnected, but if he is connected twice it is not a good idea to do
it that way. Then you should add $Name in your filename to be used and
to be sent.
Ok it was a bit technical but you asked a specific question which can
be resolved in dozens of ways.
You could also make an integreation dll for it to do that work (only
for serv-u 9 and up).
WaitAMoment is available from my mini site http://tinyurl.com/ftpservertools
and is off course also totally free.
All it does is wait for a number of milliseconds..

sskw...@gmail.com

unread,
Apr 8, 2010, 12:52:37 PM4/8/10
to RhinoSoft.com User Group
I'm trying to test Part #1 of this process and nothing is being
created in the folders.

This is the part that I am testing:


First create the events you want to log e.g. File Uploaded with
Execute Command
c:\windows\system32\cmd.exe /c echo uploaded: $FileName >>c:\servu
\eventlogs\$FullName


Does this create temp directory or a temp file with the file name?

> WaitAMoment is available from my mini sitehttp://tinyurl.com/ftpservertools

FTPServerTools

unread,
Apr 11, 2010, 8:00:10 PM4/11/10
to RhinoSoft.com User Group
I havent had the time to test this in detail.. And I see I had a
mistake. The temp log file is off course supposed to be either the
system variable for the login ID or the system variable for the
username (no strange characters in it then plz).
The trick is simple, servu just translates the system variables
(starting with $ so see your help file) into the values. The c:
\windows\system32\cmd.exe /c is a command that just does a dos
command and closes again afterwards.

I was kinda doing this almost by head, just checking the help files.
This is just an option but you could also do it very differently, e.g.
with vbscript...

c:\windows\system32\cscript.exe //b c:\servu\LogEvents.vbs $Name
UPLOAD $FileName

And LogEvents.vbs being (untested but I assume you can correct the
mistakes since it is simple vbscripting).
Dim fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.OpentextFile("c:\servu\logfiles
\"+wscript.arguments(0)+".log",8)
f1.WriteLine(wscript.arguments(1)+" "+wscript.arguments(2))
f1.Close

That would open/create a file in c:\servu\logs (dir must exist!!) and
write a line in it...
As I said you can resolve this in so many ways... All you need is some
scripting to write to a temporary file and then when the user logs off
or disconnects to send the file to the user... The system variables
have a lot of power...
Alternatively you could make yourself a dll in servu 9 as well... This
is somewhat more complicated tho the guys from servu put a complete
working example in the servu dir. You would need a compiler tho
(visual studio preferred).

sskw...@gmail.com

unread,
Apr 13, 2010, 9:43:34 AM4/13/10
to RhinoSoft.com User Group
Unfortunately, I'm not a coder/software developer so I don't have a
wealth of experience with VBScripting.

Do you have any working examples of a summary email notification that
I could reference?

FTPServerTools

unread,
Apr 13, 2010, 5:43:28 PM4/13/10
to RhinoSoft.com User Group
Only for serv-u 7 and down. I would need to find some time to really
fully test an example. And my agenda kinda is over busy usually. That
it is possible is obvious for me since I already played with events
and event with my own dll..
But you would need to be a lot more precise on what you wanted since
you are not a coder.
So details like what do you want to send exactly etc... So if you
could write it out for yourself on paper in details with a examples
that would be way more helpfull. All I gave you was the basic scheme
on how to implement it assuming you had some basic coding
experience...
Although this is hardly worth the term coding tho...
Reply all
Reply to author
Forward
0 new messages