How to Send Log File via Email
- Download open source tool - MAILSEND - from this web site:
http://www.muquit.com/muquit/software/mailsend/mailsend.html#howtouse
- Save the mailsend.zip to your local drive. I chose the following folder:
C:\Program Files\Windows Resource Kit\Mailsend
- Go to that location
- Extract the file - mailsend.zip. Result is mailsend.exe
- Move mailsend.exe to: C:\Program Files\Windows Resource Kit\Mailsend folder
- Create folder BATCH_FILES (I usually put it in the root of C drive - C:\BATCH_FILES)
- Open BATCH_FILES folder
- Right-click anywhere in the BATCH_FILES folder and select New, Text file
- Rename the file to reflect the job it is going to do for you - example: IPSENTRY_LOG_FILE.BAT
- Edit the file in any text editor (Notepad for example)
- Copy/paste the following text into the batch file (IPSENTRY_LOG_FILE.BAT):
set file=MO%date:~10,4%%date:~4,2%%date:~7,2%.LOG
set datum=%date:~4,2%_%date:~7,2%_%date:~10,4%
"C:\Program Files\Windows_Resource_Kit\MAILSEND\mailsend.exe" -d shaw.ca -smtp <FQDN_of_your_SMTP_server> -t you@yourdomain.com -f you@yourdomain.com -sub "IPSentry Log File %datum%" < "C:\Program Files\RGE INC\IPSentry\LogFiles\%file%"
NOTE:
set file=MO%date:~10,4%%date:~4,2%%date:~7,2%.LOG - IPSentry's log file format is MOYYYYMMDD.LOG so I had to create temp with this format. End result is when I enter echo %file% in Command Prompt I get MO20100927.LOG which is the format I wanted. Of course you will have to modify it to fit your date format and needs.
set datum=%date:~4,2%_%date:~7,2%_%date:~10,4% - I created new variable datum as I wanted to let myself know what date is the log file from in the email subject field
-t - is the recipient
-f - is the sender
-sub - is the Subject line of the email you are going to send
- Save the file
- In another Notepad copy/paste the following text and edit it to fit your needs:
AT 11:59PM /every:M,T,W,Th,F,S,Su "C:\BATCH_FILES\IPSentry_Log_File.bat"
- Start Command Prompt
- Copy/paste above line into Command Prompt
- Press Enter to execute it
- You should see the following result:
- Now you are ready to receive email with information saved in the log file
- Close all windows and you are done
