LostInVB 0 Newbie Poster

I have put together this whole network account creation and audit process. The creation process starts with importing data from our ADP system into SQL 2005 and creating a .csv file for each of the 12 sites to create the network accounts, based on job title. Then I add in all the proper group memberships base on that job title and send an email to the remote site staff with an attachment so they know what accounts were created that day.

I have all of that working. The problem is they get an email even if no accounts were created that day, that is one email for each job title I have configured. I would like to add into my send mail script that if the file I am attaching is larger than 84kb to complete the script and send the email with the file. Other wise stop right there. 84kb is the size of the file with the header line only. No account information.

I have no clue how to do this. Does anybody have the time to help me out? I'm mostly a script kitty but I am trying very hard to learn as I go. I have managed to get the rest of the process working correctly with information I could on the web.

This is my script that sends the email

'---------------------------------
'‘****************  Automatted accounts created  *************  Email report with attachment***
On Error Resume Next
'wscript.echo "Start"

Dim iMsg 
Dim iConf 
Dim Flds 
Const cdoSendUsingPort = 2

Emailcontent = "<html><body><span style='font-size:12.0pt;color:black'>Attached below is a current listing of all new employee's who had network accounts created today.<BR><BR> Please review the accounts and if any errors to the accounts need to be reported, please contact the help desk at XXX-XXX-XXXX or email helpdesk@XXXXX.net. <BR><BR>This report and accounts are automatically generated and sent out on a scheduled basis, If you need us to make any modifications please contact xxxxx xxxx at xxx-xxx-xxxx or email ar xxxxx@xxx.net.<BR><BR><BR><BR><BR><BR>"

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort 
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SecuritySMTP.xxxxx.net" 
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10  
    .Update
End With


		With iMsg
   		Set .Configuration = iConf
			.TO = "#TUL-Trainers@XXXXX.net"
			.CC = "helpdesk@XXXXX.net"
			.BCC = "XXX@XXXXX.net"
 			.From = "ZZZZAutomatedProcess@xxxxx.net"
    			.Subject = "New network accounts created today for Tulsa Customer1"
    			.HTMLBody = EmailContent
			.addAttachment "L:\Scripts\CreateNewUserAccounts\Tulsa\customer1\Newusers.csv"
			.Send
	End With

'wscript.echo "The end"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.