Results 1 to 9 of 9

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

  1. #1
    New Member
    Join Date
    May 12
    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 04
    Posts
    18,520

    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
    New Member
    Join Date
    May 12
    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 04
    Posts
    18,520

    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 12
    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 04
    Posts
    18,520

    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
    New Member
    Join Date
    May 12
    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
    New Member
    Join Date
    May 12
    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 04
    Posts
    18,520

    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

Posting Permissions

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