CDO message - filename not appearing in message if run vbs from server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LondonCalling
    New Member
    • Jan 2007
    • 2

    #1

    CDO message - filename not appearing in message if run vbs from server

    The script below is designed to send an email when file appears in a folder; the subject is set to the filename and the body includes the file path. If I run the script from my C drive, the email is fine; if I run it from a server the email has a blank subject and no filepath. Does anyone know why? Thank you
    Code:
    strRejectionsSourceFolder = "\\iseries\myfolder\"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = WScript.CreateObject("WScript.Shell")
    'Cycle through any files in the source folder
    For Each sFile In objFSO.GetFolder(strRejectionsSourceFolder).Files
    'Prepare an email to notify someone of the rejection
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject=sFile.Name
    myMail.From=strRejectionsEmail
    myMail.To=strRejectionsEmail
    myMail.TextBody="A file has been rejected:" 
    myMail.TextBody= myMail.TextBody & vbcrlf & sfile.path
    ...set config fields and send...
    … move the file…
    Next
  • Luk3r
    Contributor
    • Jan 2014
    • 300

    #2
    If I understand correctly, you're running the script from a different server than the server that has the file/folder. Are you sure Server #2 has access to the folder on Server #1?

    Comment

    Working...