And it is possible if we combine windows task manager, some vb script, 7z and a Gmail account. You can download the source code at sendMail. The zip file contains 3 files:
- sendMail.vbs - vb script
- 7z.exe - program to create the zip file
- logs.txt - log file to log the time and the events
homePath = "C:\xxx\" 'folder where sendMail.vbs, logs.txt, 7z.exe and created zip files are
dataPath = "C:\xxxx\" ' folder that contains the files to zip
attachFile ="zipFile.ZIP" 'created zip file that will be attached to the e-mail
if zipFile("MAP*.?10") = 0 then ' file name of the file to zip or a wildcard containing the files to zip
For sending the e-mail, configure correctly the following parameters with your Gmail account details:
.from = "email@example.com"
.To = "firstname.lastname@example.org; email@example.com" .Subject = "Test Mail" .Textbody = "The quick brown fox " & Chr(10) & "jumps over the lazy dog"
.Item (schema & "smtpserver") = "smtp.gmail.com"
.Item (schema & "sendusername") = "firstname.lastname@example.org"
.Item (schema & "smtpaccountname") = "email@example.com"
.Item (schema & "sendpassword") ="xxxxxx"
You can test it double clicking on the sendMail.vbs file and checking thee events logged on the logs.txt.
Later I will be explaining how run this file regularly from windows task manager.