Tough one

Discussion in 'Scripting' started by Alexis Mieles, Feb 19, 2006.

  1. Hi Everyone,

    Quick question: I've seen quite a few scripts in the forum for sending a CDO
    email, and some for searching through a file, but I am clueless as how to put
    them together.

    For example, I have a file called err.log which I output the details of a
    process to, does someone know of a method to read the contents of the file or
    portions of the content and then send it in the body of an email to
    recipients who need to review?
    Not sure if I can utilize blat.exe, grep, or tail in this case though.

    Thank you for your time and assistance in advance,

    Alexis
     
    Alexis Mieles, Feb 19, 2006
    #1
    1. Advertisements

  2. If you just want to post the complete log, you can add is as an attachment :

    Set objEmail = CreateObject("CDO.Message")
    objEmail.From = ""
    objEmail.To = ""
    objEmail.Subject = "Process Errors"
    objEmail.AddAttachment("c:\log.txt")

    or read it in a variable first, and put it in the body :

    Const FOR_READING = 1
    Const FILE_NAME = "C:\log.txt"

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set objFile = fso_OpenTextFile(FILE_NAME, FOR_READING,True)
    txt = objFile.ReadAll
    objFile.Close

    objEmail.Textbody = txt

    gr /\/\o\/\/
     
    /\\/\\o\\/\\/, Feb 19, 2006
    #2
    1. Advertisements

  3. Thank you very much for the assistance, this was very helpful to me. Now to
    play around with.

    Alexis
     
    Alexis Mieles, Feb 19, 2006
    #3
  4. Alexis Mieles

    Thomas Lee Guest

    How would you do this in Monad - and send the mail??

    /me is still having trouble with this -com stuff!!!
     
    Thomas Lee, Feb 19, 2006
    #4
  5. Lol,
    I actualy did test this in MSH

    I also did this in MSH before with the .NET classes (look in comments
    for atachment),

    http://mow001.blogspot.com/2005/11/sending-mail-from-msh.html

    with COM

    $cdo = new -com "CDO.Message"
    $cdo.AddAttachment("c:\test.txt")


    gr /\/\o\/\/
     
    /\\/\\o\\/\\/, Feb 19, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.