Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook script to popup message when sending to external recipient

Status
Not open for further replies.

DotNetNewbie

Programmer
Mar 3, 2004
344
GB
Hi everyone,

I have been asked to look at methods to validate the recipient of an email after the user has clicked on send. Sadly common sense isn't the answer as most of my users don't have any!!

A suggestion I have seen is to write a script that will pop-up a window asking the user to confirm they want to send the email to 'recipient' - but only if the email address is outside of our email domain.

Any suggestions most welcome.
 
Managed to do it myself in the end:

Dim strMsg As String
Dim strEA As String
Dim strER As String
Dim i As Integer

strER = ""
For i = 1 To Item.Recipients.Count
strEA = ""
On Error Resume Next
strEA = Item.Recipients(i).AddressEntry.GetExchangeUser.PrimarySmtpAddress
On Error GoTo 0
If Not Mid(strEA, InStr(strEA, "@") + 1) = "mydomain.com" Then
If strER = "" Then
strER = Item.Recipients(i).Address
Else
strER = strER + vbCrLf + Item.Recipients(i).Address
End If
End If
Next i

If strER <> "" Then
strMsg = "You are about to send an email to the following external recipients:" & vbCrLf & vbCrLf & strER & vbCrLf & vbCrLf & "Please make sure any attachements are pasword protected!"

If MsgBox(strMsg, vbYesNo + vbExclamation, "Send Confirmation") = vbNo Then Cancel = True
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top