Error: The “SendUsing” configuration value is invalid

That was the error I was receiving when trying to send an e-mail using CDONTS in a VBS script. But I found a post by Jeff on that was exactly what I was looking for.

The script was created to be run daily as a scheduled task, and to notify a user when disk space dropped below 15% of the drive’s total storage capacity.

This is the complete script, with comments at the end:
Option Explicit

Dim objFSO
Dim objDrive
Dim TotalSize
Dim AvailableSpace
Dim Percent
Dim objEmail

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDrive = objFSO.GetDrive("C:")
AvailableSpace = objDrive.AvailableSpace
TotalSize = objDrive.TotalSize
Percent = (AvailableSpace / TotalSize) * 100
If Percent > 15 Then
 Set objEmail = CreateObject("CDO.Message")
 objEmail.From = ""
 objEmail.To = ""
 objEmail.Subject = "Server ZZZ is running low on disk space"
 objEmail.Textbody = "Server ZZZ is running low on disk space. " & AvailableSpace / 1024 & "MB is remaining of the total disk size of " & TotalSize / 1024 & "MB."
 objEmail.Configuration.Fields.Item("") = 2
 objEmail.Configuration.Fields.Item("") = ""
 objEmail.Configuration.Fields.Item("") = 25
End If

The script originally was created without these lines:

 objEmail.Configuration.Fields.Item("") = 2
 objEmail.Configuration.Fields.Item("") = ""
 objEmail.Configuration.Fields.Item("") = 25

The error was thrown at the objEmail.Send line. After adding the lines, it worked perfectly.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: