Basically...this script is tied to a program I created that generates the text files...I am trying to make it grab the text from the Subject.txt and put into the subject line and same thing with the body of the e-mail just using the body.txt
It does not seem to be working...
Code:Set myNetwork = WScript.CreateObject("WScript.Network") Dim myUserName Dim myComputerName Dim ol, ns, newMail myUserName = myNetwork.UserName myComputerName = myNetwork.Computername Set ol = WScript.CreateObject("Outlook.Application") Set ns = ol.getNamespace("MAPI") ns.logon myUserName,"password" ',true, false Set newMail = ol.CreateItem(olMailItem) newMail.To = "myemail@gmail.com" Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:\users\public\documents\body.txt", 1) Set objFile2 = objFSO.OpenTextFile("C:\users\public\documents\Subject.txt", 1) Do Until objFile.AtEndOfStream strCharacters = objFile.Read(1) newMail.Subject = myUserName & Wscript.Echo strCharacters Do Until objFile2.AtEndOfStream strCharacters = objFile2.Read(1) newMail.Body = Wscript.Echo strCharacters & FormatDateTime(Now(), vbGeneralDate) newMail.Send


Reply With Quote