To prevent the sending of mass emails to recipients in the To field, a popup message can appear when sending to more than X number of recipients.
I have created a code that will do just this.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim Warn As String
Dim Warn2 As String
Dim Popup As String
Dim Popup2 As String
Dim bcccount As Long
Dim tocount As Long
Dim i As Long
Dim i2 As Long
Warn = "Please check if email addresses are in BCC! Click OK to send anyway"
Warn2 = "Are you sure you want to send?"
For i2 = 1 To Item.Recipients.Count
If Item.Recipients(i2).Type = olTo Then tocount = tocount + 1
Next i2
For i = 1 To Item.Recipients.Count
If Item.Recipients(i).Type = olBCC Then bcccount = bcccount + 1
Next i
If tocount > 4 And bcccount = 0 Then
Popup = MsgBox(Warn, vbOKCancel + vbCritical)
If Popup <> vbOK Then
Cancel = True
ElseIf MsgBox(Warn2, vbYesNo + vbQuestion) <> vbYes Then
Cancel = True
End If
End If
End Sub
Sidd below has helped me with the problem! The code at the top works as intended to check both To and BCC fields before sending!