I have a working VBS script that I had tested and was able to send emails with. It was a kind of template that can be modified for various uses. The problem I hit was when i tried to add a file as an attachment it threw some odd errors and I cannot find out why. It acts like I am leaving off a delimiter such as ) but they all seem to be here.
In researching this problem I found another one which may also prevent it from working as needed anyway. The attached file is .nfo file generated by msinfo32.exe, which may not be an allowed file type.
My intent was to come up with a single package I could send to employees in need of help on their systems, I can generate the NFO file showing everything I would need to know about their system within a batch and then call the mailtome.vbs to send the file to my email.
It all works except for that one error killing it in line 12; This is line 11 forward>
In researching this problem I found another one which may also prevent it from working as needed anyway. The attached file is .nfo file generated by msinfo32.exe, which may not be an allowed file type.
My intent was to come up with a single package I could send to employees in need of help on their systems, I can generate the NFO file showing everything I would need to know about their system within a batch and then call the mailtome.vbs to send the file to my email.
It all works except for that one error killing it in line 12; This is line 11 forward>
Code:
For a = 0 to objArgs.Count - 1
Set oAttachments = oEmailItem.Attachments.Add(objArgs(c:\temp\test.nfo))
subjectStr = subjectStr & Right(objArgs(a),Len(objArgs(a))-(InStrRev(objArgs(a),"\"))) & ", " 'recreates the default Subject e.g. Emailing: file1.doc, file2.xls
Next
If subjectStr = "" then subjectStr = "No Subject "
oEmailItem.Subject = "MyUtilitiez " & Left(subjectStr, (Len(subjectStr)-2))
oEmailItem.BodyFormat = olFormatHTML
oEmailItem.Display
oEmailItem.Send