These macros check the number of recipients on an outgoing message and if there are more than a specific number of recipients, asks what you want to do with it. The first macro lets you cancel the send, the second macro sends the message, moving the addresses to the BCC field if you click Yes, and sends as is when you click No.
To look for messages containing attachments then confirm you really want to send the attachment to everyone, see Do you want to send an attachment?
Cancel the send if more than 1 recipient
Change the recipient count (Item.Recipients.Count > 1) to the desired number.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim intRes As Integer
Dim strMsg As String
If Item.Recipients.Count > 1 Then
strMsg = "Your message " & Chr(34) & Item.Subject & Chr(34) & _
" contains " & Item.Recipients.Count & " recipients. " & vbCrLf & vbCrLf & _
"Do you want to send this message?"
intRes = MsgBox(strMsg, vbYesNo + vbExclamation, "Confirm Message Send")
If intRes = vbNo Then
' cancel send
Cancel = True
End If
End If
End Sub
Move the addresses to the BCC field
Use this code to move addresses in the To and CC fields to the BCC field.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim intRes As Integer
Dim strMsg As String
Dim i As Integer
If Item.Recipients.Count > 1 Then
strMsg = "Your message " & Chr(34) & Item.Subject & Chr(34) & _
" contains " & Item.Recipients.Count & " recipients. " & vbCrLf & vbCrLf & _
"Do you want to move them to the BCC field?"
intRes = MsgBox(strMsg, vbYesNo + vbExclamation, "Confirm Message Send")
If intRes = vbYes Then
For i = 1 To Item.Recipients.Count
Item.Recipients(i).Type = 3
Next i
End If
End If
End Sub