Confirm Each Recipient in a New Outlook Mail Before it is Sent

  • Thread starter Thread starter Gruver
  • Start date Start date
G

Gruver

In Microsoft Outlook (2007) is there any way you can write code that will
present you with a message box asking you to confirm each of the recipients
in an e-mail after you click 'Send' and immediately before the e-mail is
dispatched to the server?

After I click on 'Send' I'd like to see a message box with something like
"Please confirm that you wish to send this e-mail to A and B and C (and that
you wish to copy X and Y and Z)". Ideally I'd like to see the names as they
appear in my address book i.e. 'John Doe' rather than
'(e-mail address removed)'.

The e-mail would only be sent after you confirmed the recipients by clicking
on the 'OK' button on the dialog box. If you clicked 'Cancel' you would be
returned to the e-mail and could then either add or remove recipients. The
message box would also prevent accidental sending (by mistakenly clicking the
'Send' button or by typing 'Alt+S').

I'm sure many would find the message box annoying but I would find it very
helpful. I know you can double-check the names in the address fields before
clicking Send (which I always do anyway) but there are times when a double
check would be very useful.

I've looked for some code to achieve this (I'm not entirely familiar with VB
in Outlook) and came across the code below which I think is trying to do
something very similar to what I want but I can't get it to work.

If anyone can point me in the right direction I'd be very appreciative.

http://blogs.technet.com/kclemson/archive/2004/01/02/47268.aspx

How about a simple confirmation message asking if you really want to send
it? You can do this by pasting the code below into your ThisOutlookSession
VBA module:

Option Explicit
Dim WithEvents objInspectors As Inspectors
Dim WithEvents objMyNewMail As MailItem

Private Sub Application_Startup()
Set objInspectors = Application.Inspectors
End Sub

Private Sub Application_Quit()
Set objInspectors = Nothing
Set objMyNewMail = Nothing
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class <> olMail Then Exit Sub
Set objMyNewMail = Inspector.CurrentItem
End Sub

Private Sub objMyNewMail_Send(Cancel As Boolean)
If MsgBox("Are you sure you want to send this message?", vbYesNo +
vbQuestion _
, "SEND CONFIRMATION") = vbNo Then
Cancel = True
End If
End Sub
 
You can simplify this task a lot by using just the Application.ItemSend
event:

Write code for the Application_ItemSend event handler, e.g.:

Private Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
Dim strMsg as String
strMsg = "To recipients = " & Item.To & vbCrLf & vbCrLf & _
"Cc recipients = " & Item.To & vbCrLf & vbCrLf & _
"Are you sure you want to send this message?"
If MsgBox(strMsg, vbYesNo + vbQuestion _
, "SEND CONFIRMATION") = vbNo Then
Cancel = True
End If
End Sub
 
Many thanks. I pasted the code into the ThisOutlookSession Object for the
ItemSend event but it didn't seem to do anything. Is there anything else that
I need to do?
 
Hi All,

I know this is an old thread but I hope you're still watching...

Using the above code if I receive a Meeting request and select send response now the code fails at the line "Are you sure you want to send this message?".

UPDATE: This also happens if I try and create a new meeting request.

Any ideas how to best handle meeting requests send response now in the code?

Many thanks,

Mike
 
Last edited:
Back
Top