Results 1 to 12 of 12

Thread: [Outlook] Warning message before sending email to external address.

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    4

    [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

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [Outlook] Warning message before sending email to external address.

    "Cc recipients = " & Item.To &
    at a guess this should be
    vb Code:
    1. "Cc recipients = " & Item.CC &
    or something similar

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    4

    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.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [Outlook] Warning message before sending email to external address.

    assuming the server is the string after the @
    vb Code:
    1. if not mid(item.to, instr(item.to, "@") + 1) = "myserver.com" then 'do stuff
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5
    New Member
    Join Date
    Aug 2012
    Posts
    1

    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

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    4

    Re: [Outlook] Warning message before sending email to external address.

    Quote Originally Posted by bullerd View Post
    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,

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    4

    Re: [Outlook] Warning message before sending email to external address.

    Any script expert out there
    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.

  9. #9
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [Outlook] Warning message before sending email to external address.

    My boss asked again to implement pop-up/verification when sending email to external address
    possibly he should hiring a professional to do this

    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?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  10. #10
    New Member
    Join Date
    Feb 2015
    Posts
    1

    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

  11. #11
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    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!

  12. #12
    New Member Mirra85's Avatar
    Join Date
    Mar 2015
    Posts
    1

    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.**

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width