Hi,

some of my team members sends out email to outside my office email address, domain address is @Arvind.com

just to avoid this, i have the below code which checks and prompts whether the user before then send.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim recips As Outlook.Recipients
Dim recip As Outlook.Recipient
Dim pa As Outlook.PropertyAccessor
Dim prompt As String
Dim strMsg As String


Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"


Set recips = Item.Recipients
For Each recip In recips
    Set pa = recip.PropertyAccessor
            If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@in.Arvind.com") = 0 Then
              If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@uk.Arvind.com") = 0 Then
                If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@ie.Arvind.com") = 0 Then
                 If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@Arvind.ie") = 0 Then
                 strMsg = strMsg & "   " & pa.GetProperty(PR_SMTP_ADDRESS) & vbNewLine
                 End If
                End If
              End If
            End If
Next
For Each recip In recips
    Set pa = recip.PropertyAccessor
    If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@in.Arvind.com") = 0 Then
      If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@uk.Arvind.com") = 0 Then
       If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@ie.Arvind.com") = 0 Then
        If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@Arvind.ie") = 0 Then
       prompt = "This email will be sent outside of mydomain.com to:" & vbNewLine & strMsg & "Do you want to proceed?"
        If MsgBox(prompt, vbYesNo + vbExclamation + vbMsgBoxSetForeground, "Check Address") = vbNo Then
         Cancel = True
         Exit Sub
         End If
        End If
       End If
      End If
    End If
    
 Next
End Su
but most of the time they have to send to outsiders as well, but they have to mention the name in subject line, and they miss it always. I would like to add one more condition to this, in case any of them sending an email to outsiders, they have to mention the domain name in subject line.

eg if any of them sending email to xxxx@vbaexpress.com
then they have to mention in the subject line - vbaexpress ( domain name)
if they miss it, a prompt message should come

Can anyone help with this

Regards
Arvind