Auto name checking upon Tab or Click off To field(s)

Status
Not open for further replies.

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
We have some users with itchy clicker fingers who love to hit Send without completing To addresses. I’ve enabled “Automatic name checking” in Group Policy, but all that does it put a squiggly red line beneath the still incomplete address (if it’s non-unique). I realize they get prompted to Check Names when they hit Send, but apparently those itchy clicker fingers love to double click random names (gotta love those PEBCAK errors).

My question is, is there a way to invoke a “Check Names” prompt auto/programmatically when tabbing from, or clicking off, the To/Cc fields (prior to hitting Send)?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
It's easier to auto check when the Send button is hit, then cancel if a name cannot be resolved. Just keep in mind that even nonsense is resolved as long as it looks like a valid email address.
Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  if item.recipients.resolveall=false then
    cancel=true
  endif
End Sub
 

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
It's easier to auto check when the Send button is hit, then cancel if a name cannot be resolved. Just keep in mind that even nonsense is resolved as long as it looks like a valid email address.
Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  if item.recipients.resolveall=false then
    cancel=true
  endif
End Sub

Where would I implement this code snippet? (Sorry, not a macro/VBA guy.)
[DOUBLEPOST=1440688654][/DOUBLEPOST]
Names autoresolve against contacts (and properly formatted addresses resolve) when you tab out of the fields but the dialog only comes up if they don't take the steps to fix unresolved entries before sending.

Right. I'm just looking for a way to force a Check Names prior to hitting Send.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Michael - what about triggering a macro as they tab out of the fields - maybe a dialog box that says there are unresolvable addresses that need fixed?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
There's no event that triggers when you tab out. You could use the PropertyChange event, which is quite complicated to use for addresses. Thus I mentioned the ItemSend event. It should sufficiently do the trick: do not send if there's an unresolved address.
 

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
There's no event that triggers when you tab out. You could use the PropertyChange event, which is quite complicated to use for addresses. Thus I mentioned the ItemSend event. It should sufficiently do the trick: do not send if there's an unresolved address.

Just to clarify, how does the Send process get modified in this instance? User hits Send, Check Names pops up as usual due to an unresolved address, user selects address from list....then what? Are they returned to the composition window until they hit Send again?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Hmmm. Resolve is triggered before item send - so the macro doesn't really add any benefit as outlook won't attempt to send bad addresses until they are resolved. You want to jump in before the resolve dialog comes up or cancels resolve and throws it back to the message.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Sure, Outlook wouldn' send anyway. The problem actually is: If users don't look at what they click on, there's nothign you can do to prevent it.

There's the BeforeCheckNames event, I just don't see how it could be helpful in this case.
 

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
What about the trigger that causes the red underlines? Is there a way to hook into that? Or would that also hook into spell check as well?
 

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Taking a different approach, what about changing the button layout for new messages? As a test, I've customized the ribbon to display Send and Check Names buttons on the far left (right above the actual Send button). And I've figured out how to "design this form" via the Developer menu, but I see no option to remove the Send button from the form (or to add a Check Names button right next to it). If we could do that, then the new layout plus a little user re-training could go a long way toward resolving the issue. Thoughts?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
What about the trigger that causes the red underlines?
The only event is the BeforeCheckNames event. Depending on the outcome, Outlook will underline the address in red or in black. There's no event to tell you that CheckNames has finished and is going to prompt the user.

What do you really want to achieve? If you don't get the users now to select the names they really want to send to, how would a CheckNames button change that? BTW pressing alt+k would also call the CheckNames function.

As the user could also pick a wrong name in the first place, you could always ask before sending 'Are you sure recipient x is the one you want?'. These users will treat that prompt as they always do, they'll click OK without checking if it's really ok. So you'll end up moving in a circle.
 

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Thanks for your help Michael and Diane. We've decided to scrap the custom form/programmatic solution for now. We're going with a 3 pronged approach: 1-Enable Auto-resolve, 2-Enable Delayed Send, and 3-User policy.

So on the delayed send piece (2), I know how to create a rule to do that with all outgoing email (thanks to one of Diane's previous forum posts). And I can export that rule to an RWZ file, and manually import it. The question now is if there is a way to either import the RWZ file via script, or just create the new rule via script?
 

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Just wanted to chime in one last time to thank you both again for your patience and assistance on this, and to update you on what we finally implemented for the delayed send piece.

So we ended up creating a macro (with help from one of Diane's how-to's) to modify the Send process itself (see code below). If the subject line contains the word "immediate" then Send proceeds as usual, if not it defers delivery for 5 minutes from now. That gives users enough time to grab it in their Outbox and make any needed corrections or changes

The odd thing about deploying this is that it appears as if the code needs to be viewed (Alt+F11) to be activated. Does that make sense to you? Any way around that?

Code:
Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Dim objMailItem As MailItem       ' to hold mail item
  Dim intErrNumber As Integer
  '
  On Error GoTo Err_Handler         'Error Handling
  Set objMailItem = Item            'Set object to mail item just sent
  'If objMailItem.Subject <> "Immediate" Then
  If InStr(1, objMailItem.Subject, "Immediate", vbTextCompare) = 0 Then
    objMailItem.DeferredDeliveryTime = DateAdd("n", 5, Now)     'Delay is + 2 minutes
   End If
  Exit Sub
Err_Handler:
'Due to lack of concentration of the code writing genius there has been a bit of an error,
'  lets tell someone about it by popping up a message box with a detailed description on the screen.
  intErrNumber = Err.Number
  If intErrNumber = 13 Then
   'Nothing.
  Else
    MsgBox ("An error has occured on line " & Erl & ", with a description: " & Err.Description & ", and an error number " & _
       Err.Number)
  End If
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Correct, if you deploy code, users will need to open the editor to enable it. There is no way around it, should of compiling an addin instead of using a macro.
 

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Correct, if you deploy code, users will need to open the editor to enable it. There is no way around it, should of compiling an addin instead of using a macro.
What would be the easiest way to compile it into an add-in? Visual Studio? Would that add-in then be deploy-able (MSI, EXE, etc.)?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Visual studio and yes, you can deploy it automatically.
 

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Sorry to resurrect what seemed like a closed case, but we're receiving some push back from users (careful what they wish for) regarding the new send delay. I'm wondering if there's a way to set the DeferDelivery time to say 5 seconds if the user checks a box in a custom message form. Then rework the script to not overwrite any non-default delay (so the above override, plus say a compose Sat/send Mon type scenario as well). The scripting logic seems like the easy part, whereas tying it to a user selection seems much more involved. Any thoughts?
 

dohodoho

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Hi Brian,

As an alternative to a delay, you could look into using various add-ins for preventing accidental emails being sent. "Safeguard Send" and "SafeSend" are a few that do this in various forms, they might help you.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Outlook Rules - Changing auto-submit address in multiple rules, according to rule name Outlook VBA and Custom Forms 0
C Auto subject,name,email,deferred Using Outlook 2
C Auto Run VBA Code on new email Outlook VBA and Custom Forms 1
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
V Auto-Submitted: auto-replied in header Using Outlook 0
R Auto display of new email does not work on non-default account Outlook VBA and Custom Forms 0
B Outlook 2016 Auto-archive creates new folder Using Outlook 4
J Edit auto-complete list in Outlook 2016+/365? Using Outlook 0
P Auto assign shared mailbox Outlook VBA and Custom Forms 1
M Outlook 2010 Problem with OutLook 2010 32 bit, after Windows Auto Update Using Outlook 3
P [SOLVED] Auto remove [EXTERNAL] from subject Using Outlook 14
Z Add text to auto-forwarded e-mail Outlook VBA and Custom Forms 4
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
Q Prompt button to auto turn on Out of Office Outlook VBA and Custom Forms 3
P Auto Insert Current Date or Time into Email Subject Outlook VBA and Custom Forms 2
S Messages moved / deleted by auto-archive are not synchronized to exchange Exchange Server Administration 8
B Outlook 2010 is Auto Purging when not configured for that Using Outlook 1
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8
A Auto Accept Meetings from the General Calendar Using Outlook 3
R auto send email when meeting closes from a shared calendar only Outlook VBA and Custom Forms 2
S auto-mapping mailboxes in outlook impacting an ost file? Exchange Server Administration 2
M Auto expand Distribution List Before Sending Email Outlook VBA and Custom Forms 1
M Auto-export mail to Excel Outlook VBA and Custom Forms 2
Ms_Cynic Auto-pasting email content in calendar appt? Using Outlook 2
R How Do I insert images in and Auto Reply Using Outlook 3
S Received mail as part of DL, need to auto-CC the same when replying Outlook VBA and Custom Forms 5
T Have Outlook 2016 suggest email address auto complete entries directly from the user's contacts list Using Outlook 10
T Have Outlook 2016 suggest email address auto complete entries directly from the user's contacts list Using Outlook 0
P Auto scroll to specific folder in Folder Pane Outlook VBA and Custom Forms 3
C Auto categorize duplicate subjects Outlook VBA and Custom Forms 11
N Auto-complete - block select emails Using Outlook 3
C Auto save outlook attachments when email is received Outlook VBA and Custom Forms 1
J HELP- Rule to auto strip prepend from external emails Using Outlook 0
S BCM Auto Backup Data and Customizations BCM (Business Contact Manager) 6
G Auto accept meeting request for non primary account Outlook VBA and Custom Forms 1
E Outlook Form - Voting Responses Not Auto Processing If Form Contains Any Code Outlook VBA and Custom Forms 0
J Auto Forward - Include Attachment and change Subject depending on original sender Outlook VBA and Custom Forms 3
K Extract email address from body and auto-reply outlook Using Outlook 1
S Auto move search results to folder Outlook VBA and Custom Forms 0
E Outlook 2010 disable date auto-complete Using Outlook 2
ashcosta2 Auto Reply rule based on speficied time Outlook VBA and Custom Forms 0
B Auto Preview Attachment in Inspector Reading Pane Outlook VBA and Custom Forms 1
Z Auto Forward Using Outlook 4
M can anyone recommend an alternative to DS auto-followup? Using Outlook 2
S Rules to auto redirect Using Outlook 5
B Auto Save of Attachments from Multiple Emails and forward attachments to user group Outlook VBA and Custom Forms 1
A Auto Insert of filename when selecting 'Remove Attachment' Using Outlook 1
C Auto Add a PDF to an outgoing Email, based on a rule Using Outlook 2
B Auto open PDF Outlook VBA and Custom Forms 0
P Is it possible to convert address book to "Auto-Complete List" (NK2)? Using Outlook 5

Similar threads

Top