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 = "

" strBody = strBody & "Daily Bucket Count for " & rs.Fields(1).Value & " alias" strBody = strBody & "

" strBody = strBody & "There are currently " strBody = strBody & rs.Fields(0).Value & " buckets assigned to this alias in the OCA Analysis DB." strBody = 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 & "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "" Do While rsTen.EOF = False If IsNull(rsTen.Fields(0).Value) Then strBody = strBody & "   " Else strBucketNumber = rsTen.Fields(0).Value End If If Len(strBucketNumber) > 5 Then strBody = strBody & "" Else strBody = strBody & "" End If If Len(rsTen.Fields(1).Value) > 15 Then strBody = strBody & "" ' ElseIf Len(rsTen.Fields(1).Value) > 5 Then ' strBody = strBody & "" Else strBody = strBody & "" End If If Len(rsTen.Fields(2).Value) > 5 Then strBody = strBody & "" Else strBody = strBody & "" End If If Len(rsTen.Fields(3).Value) > 5 Then strBody = strBody & "" Else strBody = strBody & "" End If If IsNull(rsTen.Fields(4).Value) Then strBody = strBody & "" Else strBody = strBody & "" End If If IsNull(rsTen.Fields(5).Value) Then strBody = strBody & "" Else strBody = strBody & "" End If strBody = strBody & "" rsTen.MoveNext Loop End If strBody = strBody & "
Bucket#BucketIDFollowupCountBugIDSolutionID
Buckets
" strBody = strBody & strBucketNumber & "" strBody = strBody & strBucketNumber & "" ' strBody = strBody & " 10 Then ' strBody = strBody & "" & rsTen.Fields(1).Value & "" & rsTen.Fields(1).Value & "" & rsTen.Fields(1).Value & "" & Left(rsTen.Fields(2).Value, 25) & "" & rsTen.Fields(2).Value & "" & rsTen.Fields(3).Value & "" & rsTen.Fields(3).Value & "" & "   " & "" strBody = strBody & "" strBody = strBody & rsTen.Fields(4).Value & "" & "   " & "" & rsTen.Fields(5).Value & "
" oMail.HTMLBody = strBody oMail.Send End If rs.MoveNext ' Next Loop If rs.State = 1 Then rs.Close End If If cn.State = 1 Then cn.Close End If Set oMail = Nothing Set rs = Nothing Set cn = Nothing