[Outlook] Warning message before sending email to external address.
Hi all,
My boss wants me to inplement a warning (notification) pop-up that confirm the recipient name before they send email out. Exp: Are you sure you want to send this message? to recipients: XXX, CC recipients: YYY.
Here is the script that i found online:
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
The problem that i have right now is:
-the CC fieldd is not populate (it has the sam info as TO field)
-I want it only pop-up if i send email out to external recipient.
-got the run-time error '438' when send or receive meeting request.
Since we are running exchange 2007 and outlook 2007, Mailtips is not an option for us and i dont know much visual basic programing.
Really appreciate for any help.
Thanks in advance
Re: [Outlook] Warning message before sending email to external address.
Quote:
"Cc recipients = " & Item.To &
at a guess this should be
vb Code:
"Cc recipients = " & Item.CC &
or something similar
Quote:
I want it only pop-up if i send email out to external recipient.
you would need to parse the recipients email address to find if the server does not match your sever
Re: [Outlook] Warning message before sending email to external address.
Thanks Pete,
Your suggession work great on CC field. Please ignore my VB skill :), but how do i "parse the recipients email address". Thanks again.
Re: [Outlook] Warning message before sending email to external address.
assuming the server is the string after the @
vb Code:
if not mid(item.to, instr(item.to, "@") + 1) = "myserver.com" then 'do stuff
Re: [Outlook] Warning message before sending email to external address.
I have this code working ok. However it doesn't handle appointment attendee emails or appointment acceptance emails. For example it comes up with "runtime error 438 - object doesn't support this property or method".
Is there any way or having the confirmation box work with appointment emails properly or even just have it ignore appointment emails so it doesnt come up with the runtime error?
Thanks
Re: [Outlook] Warning message before sending email to external address.
you should be able to test what object item is then ignore those that are for appointments, or add code if required for the appointment ones
unfortunately i do not have outlook installed, so can not help you with code
check in the locals window to find what object type is returned for item on each occasion
Re: [Outlook] Warning message before sending email to external address.
Quote:
Originally Posted by
bullerd
I have this code working ok. However it doesn't handle appointment attendee emails or appointment acceptance emails. For example it comes up with "runtime error 438 - object doesn't support this property or method".
Is there any way or having the confirmation box work with appointment emails properly or even just have it ignore appointment emails so it doesnt come up with the runtime error?
Thanks
Bullerd,
Did you able to have a sending confirmation pop -up when you send email to external address?
Thanks,
Re: [Outlook] Warning message before sending email to external address.
Any script expert out there :wave:
My boss asked again to implement pop-up/verification when sending email to external address. My current script is:
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
i tried to add the info that westconn1 suggested above with no luck. I like what westconn1 did by compared recipients email address to GAL, but i could not get it worked.
Many thanks for help.
Re: [Outlook] Warning message before sending email to external address.
Quote:
My boss asked again to implement pop-up/verification when sending email to external address
possibly he should hiring a professional to do this
Quote:
I like what westconn1 did by compared recipients email address to GAL, but i could not get it worked.
in what way did it not work,
nothing happen?
error?
wrong result?
Re: [Outlook] Warning message before sending email to external address.
There are commercial add-ins that can do this. Here are some names:
- SafeGuard Send
- SafeSend
- Outgoing Email Checker
Re: [Outlook] Warning message before sending email to external address.
I agree seeking a commercial product for this. Titus labs also makes one. I would not put my professional reputation on the line for something like this. This goes beyond the scope of VBA. Who will get blamed when that accidental email gets sent that costs a lot of $$$? YOU will!
Re: [Outlook] Warning message before sending email to external address.
Kind of problem that most us encounter from time to time. Guess the solution found here is pretty muchworkable and give good results.
**Links removed by Site Administrator so it doesn't look like you're spamming us. Please don't post them again.**