verify contact before sending

dawondr

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Hi all, I'm really hoping someone can help me. I have a couple of people that I contact that have the same first names. When I go to the "TO" line and start typing I sometimes will click the wrong name. As an example I have a man named Ron that is in my company and I also have a customer named Ron who is in my personal contacts. They do not have the same last name but when multitasking (read as not paying attention) I have sent and internal e-mail to the external client.

Is there a macro or a rule or something I can set that says if I am sending an e-mail to this person some kind of a warning or verification screen can pop? "u r sending this to Ron Jones, did you mean Smith"? Or any type of an added step to make sure I do not make that mistake again? There are only 2 duplicate names. Ron and Lawrence. One of each is in my corp contact gallery and the other one of each is in my personal contacts list if that helps to "set the trap".

I would like to think after getting burned I would remember but sad to say it has happened more than once so slowing down, paying more attention will not work. Nor will setting all messages to go out after a X minute delay because if I didnt catch it when writting it I'm not going to realize it 5 or 10 minutes later.

By the way, I am using Outlook 2007 if that matters...

Anything anyone can suggest to help me would really be appriciated.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You can use a macro to check the email address and ask - i use a similar one to make sure i use the correct email account when i send mail to a private mailing list where only one of my addresses is approved.

See http://www.slipstick.com/how-to-outlook/prevent-sending-messages-to-wrong-email-address/ for a code sample. I'd probably use this for the two addresses. if you have more than 2 to check, a case statement would be more efficient.

If InStr(LCase(Item.To), "bad@address.com") or InStr(LCase(Item.To), "otherbad@address.com") Then

There is an example on that page with a case statement, you'll want to switch the item.send line with the prompt, if, and end if lines.
 

dawondr

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
You can use a macro to check the email address and ask - i use a similar one to make sure i use the correct email account when i send mail to a private mailing list where only one of my addresses is approved.

See http://www.slipstick.com/how-to-outlook/prevent-sending-messages-to-wrong-email-address/ for a code sample. I'd probably use this for the two addresses. if you have more than 2 to check, a case statement would be more efficient.

If InStr(LCase(Item.To), "bad@address.com") or InStr(LCase(Item.To), "otherbad@address.com") Then

There is an example on that page with a case statement, you'll want to switch the item.send line with the prompt, if, and end if lines.
Thank you, one last question please, I believe the difference between the "check Messages you send" and the "Check addresses in the To, CC, or BCC field using the Recipient Collection" is just that, the first looks only at the TO line while the second would also monitor the CC line as well as the TO line correct? I'm sure that is the difference but I just want to make sure please.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Yes, the one with the To line won't check the other fields. The part that checks the recipients can be added to the macro that uses Case.
 

dawondr

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Great, thank you very much. I hope you have a great weekend.

Dave
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Actually, because the recipient collection checks each address separately, you don't need the instr part, just lcase (just in case an address uses mixed case)

If LCase(recip) ="bad@address.com" Then

or replace that line with these two

Select Case LCase(recip)
Case "alias@domain.com", "alias2@domain3.com", "alias3@domain3.com"
 

dawondr

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Hi Diane, Happy Saturday. I'm sorry to bother you but I can not get this to work. I tried entering my e-mail as a test and was able to send one to myself with no verification popping up. This is exactly what I have in my VBA windoe with the exception of my actual e-mail address. Am I missing something? This is Outlook 2007

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim Recipients As Outlook.Recipients
Dim recip As Outlook.Recipient
Dim i
Dim prompt As String


On Error Resume Next
' use lower case for the address
' LCase converts all addresses in the To field to lower case
Set Recipients = Item.Recipients
For i = Recipients.Count To 1 Step -1
Set recip = Recipients.Item(i)

If LCase(recip) = "john.smith@yahoo.com" Then
prompt$ = "You sending this to bad@address.com. Are you sure you want to send it?"
If MsgBox(prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check Address") = vbNo Then
Cancel = True
End If
End If

Next i


End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It works here. I use the code to popup a message when i send a message to one address so i can confirm I'm using the correct account - only difference is my prompt:

prompt$ = "You sending this to the list. Are you sure you want to send it from " & Item.SendUsingAccount

- - - Updated - - -

Is your macro security set to allow macros? That's a typical reason why macros don't work.
 
Top