Results 1 to 22 of 22

Thread: Promt Warning List External Users, on VB Script to checks for external users

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2018
    Posts
    13

    Promt Warning List External Users, on VB Script to checks for external users

    Hello All,
    i have the following VB Script,
    It checks for external users and promts for a confirmation if it detects any email that is not listed on the domains,

    Code:
    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
        Dim objMail As Outlook.MailItem
        Dim objRecipients As Outlook.Recipients
        Dim i As Long
        Dim strRecipientAddress As String
        Dim strPrompt As String
        Dim nWarning As Integer
     
        If TypeOf Item Is MailItem Then
           Set objMail = Item
           Set objRecipients = objMail.Recipients
     
           For i = objRecipients.Count To 1 Step -1
               strRecipientAddress = objRecipients.Item(i).Address
               'Change @example.com to your own company domain
               If InStr(LCase(strRecipientAddress), "@my1Domain.com") <= 0 Then
               If InStr(LCase(strRecipientAddress), "@my2Domain.com") <= 0 Then
               If InStr(LCase(strRecipientAddress), "@my3Domain.com") <= 0 Then
               If InStr(LCase(strRecipientAddress), "@my4Domain.com") <= 0 Then
               If InStr(LCase(strRecipientAddress), "@my5Domain.com") <= 0 Then
               Else
                  Cancel = False
               End If
               End If
               End If
               End If
               End If
               
          Next
          
             strPrompt = "Are you sure to send this email to outside your company? "
             nWarning = MsgBox(strPrompt, vbYesNo + vbQuestion, "Confirm Email to Outside Organization")
             If nWarning = vbNo Then
                Cancel = True
             End If
          End If
    End Sub
    Actually in this way everything works just fine,
    but i would like to modify the Promt, i would like to list all the external users on the Promt of the confirmation.,
    is this possible to be integrated on this script?

    Please note that i found a lot of bugs on using the following,
    Code:
    Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
    So what i'm looking for is an alternative of this.


    Thank you in advance for the support.
    Last edited by charli1; Sep 23rd, 2018 at 09:38 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width