• I use VBscript with Named Arguments where I pass the configuration file name. This configuration files contains 4 lines: TOaddresses, SubjectText, BodyText and Attachments. We do have to have 1 line batch files for different configuration files because I am trying to keep it simple for the person who manages these files. It could be replaced with one batch if you know you DOS programming well. This batch is just scheduled in Windows Task Scheduler.

    The calling batch:

    cscript "MyScriptThatSendsEmails.vbs" /ConfigFile:"TextFileContainingEmailStrings.txt"

    Code in the MyScriptThatSendsEmails.vbs has to contain the following lines in order to get the name of the configuration file.

    Set colNamedArguments = WScript.Arguments.Named

    ConfigFile = colNamedArguments.Item("ConfigFile")

    Then I use FileSystemObject to access lines in this file.

    The report itself is sent as an attachment. The report has to be pre-generated by any report tool and placed in the same directory each time for the script to be able to find it.

     

    Regards,Yelena Varsha