Ok, so it is sending an email fine. It actually is sending 250messages for some reason that I can not tell...
It also is not sending the database select information that I wanted, it is simply emailing me the subject "Inventory Items" and in the body "This is a test".
Any ideas?
This was written in vbs... I have poor vbs scripting as you can tell..
Set OBJdbConnection = CreateObject("ADODB.Connection")
OBJdbConnection.ConnectionTimeout = 20
OBJdbConnection.Open "DSN=DatabaseName;UID=sa;PWD=Password;DATABASE=MyDatabase"
SQLQuery = "SELECT cust_no, nam, bal FROM AR_CUST where bal > 1"
Set Result = OBJdbConnection.Execute(SQLQuery)
if Not Result.EOF then
Do While Not Result.EOF
SendMail Result("cust_no"), Result("bal")
Result.MoveNext
Loop
end if
OBJdbConnection.Close
Sub SendMail(TheName, TheAddress)
Dim objMessage, Rcpt
Rcpt = Chr(34) & TheName & Chr(34) & "<" & TheAddress & ">"
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Inventory Items"
objMessage.Sender = "myemail@domain.org"
objMessage.To = "myemail@domain.org"
objMessage.TextBody = "This is a test."
objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"smtp.mydomain.org"
objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
End Sub