Dim cn Dim rs Dim rsTen Dim objMail Dim strProfileInfo Dim strServer Dim strMailBox Dim objSession Dim strBody Dim strBucketNumber Set cn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") Set rsTen = CreateObject("ADODB.Recordset") 'on error resume next Set oMail = CreateObject("CDO.Message") With cn .ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=CrashDB2;Data Source=tkwucdsqla02" .CursorLocation = 3 .Open End With Set rs = cn.Execute("EmailCounts") rs.MoveFirst Do While rs.EOF = False 'For x = 0 To 10 If rs.Fields(0).Value > 0 Then Set rsTen = cn.Execute("EmailTopTen '" & rs.Fields(1) & "'") oMail.From = "pfat@microsoft.com" '' oMail.To = "sbeer@microsoft.com" 'oMail.To = "andreva" oMail.To = rs.Fields(1).Value & "@microsoft.com" 'oMail.To = "timragai@microsoft.com" 'oMail.CC = "andreava" oMail.Subject = "Daily Bucket Count" strBody = "
Click here to view the buckets "
strBody = strBody & "" & rs.Fields(1).Value & ""
strBody = strBody & "
"
If rsTen.State = 1 Then
strBody = strBody & "
Top 10 List of Buckets
"
strBody = strBody & "
Bucket# | " strBody = strBody & "BucketID | " strBody = strBody & "Followup | " strBody = strBody & "Count | " strBody = strBody & "BugID | " strBody = strBody & "SolutionID | ||||||||
Buckets | |||||||||||||
" strBody = strBody & strBucketNumber & " | " Else strBody = strBody & "" strBody = strBody & strBucketNumber & " | " End If If Len(rsTen.Fields(1).Value) > 15 Then strBody = strBody & "" ' strBody = strBody & " 10 Then ' strBody = strBody & " | " & rsTen.Fields(1).Value & " | " ' ElseIf Len(rsTen.Fields(1).Value) > 5 Then ' strBody = strBody & "" & rsTen.Fields(1).Value & " | " Else strBody = strBody & "" & rsTen.Fields(1).Value & " | " End If If Len(rsTen.Fields(2).Value) > 5 Then strBody = strBody & "" & Left(rsTen.Fields(2).Value, 25) & " | " Else strBody = strBody & "" & rsTen.Fields(2).Value & " | " End If If Len(rsTen.Fields(3).Value) > 5 Then strBody = strBody & "" & rsTen.Fields(3).Value & " | " Else strBody = strBody & "" & rsTen.Fields(3).Value & " | " End If If IsNull(rsTen.Fields(4).Value) Then strBody = strBody & "" & " " & " | " Else strBody = strBody & "" strBody = strBody & "" strBody = strBody & rsTen.Fields(4).Value & " | " End If If IsNull(rsTen.Fields(5).Value) Then strBody = strBody & "" & " " & " | " Else strBody = strBody & "" & rsTen.Fields(5).Value & " | " End If strBody = strBody & "