Solved

Prompt sender for cc

Posted on 2006-10-25
10
635 Views
Last Modified: 2008-02-01
I've done some research and I've found several thrid party software add-ons for Outlook that do auto cc/bcc. Some even allow it to be determine by rules (based on email address or subject contents, for example). The problem we have is that there are too many variables to define a realistic set of rules. For example, we have inside sales support members that deal with 2 or more sales reps. Any email correspondonce (new or replies) with a sales rep's client must be cc:ed to that rep. However, non-client related email or email to clients that don't have an assigned rep, don't need to be cc:ed to anyone.

What would be the best solution for us is if when inside support person generates (or replies to) an email that a prompt comes up to select a person to cc but have the ability to send the message whether or not they have entered/selected someone to carbon copy. I would be will to entertain any solution as long as end users can work directly from Outlook.

Thanks in advance for thought-provoking advice, recommendations or comments.
0
Comment
Question by:djinIT
  • 5
  • 5
10 Comments
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Hi djinIT,

You can do this via code by trapping the Application_ItemSend event.  This occurs every time an item is sent.  You'd need to first determine if it's a mail item, and then somehow determine if it's from an inside support person.  If yes to both, then display a dialog-box asking if they want to CC the message to someone.  If they enter an address, then add it to the CC line.  If not, then allow the send to continue.

Cheers!
0
 

Author Comment

by:djinIT
Comment Utility
Hi BDF -

If this is code that can be applied on a per client basis then I would then only need to determine if its mail. How difficult is this to do? Or better question how exactly do I get started?
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
djinIT,

Here's the solution I described.  Follow these instructions to use it.  

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code and paste it into the right-hand pane of the VB Editor window
5.  Click the diskette icon on the toolbar to save the changes
6.  Close the VB Editor
7.  Click Tools->Macro->Security
8.  Set the Security Level to Medium
9.  Close Outlook
10.  Start Outlook
11.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

This solution checks all outgoing items.  If an item is an email message and is from an inside sales rep, then it pops up a dialog-box asking them if they need to copy a sales rep.  At the moment I am forcing all messages to meet the inside sales rep test because I don't know how you want to go about determining that.  The user enters or does not enter an address or addresses.  Those addresses are then added to the message and the message is sent.  If they don't enter any address, then the message goes as is.

You asked in your last post if this code "can be applied on a per client basis".  The answer is that it depends on what you have in mind.  If you mean that you'd like it to checnk who the message is going to and act accordingly, then the answer is yes, but with a caveat.  Reading an address field from code will trigger Outlook's built in security.  This will cause a security warning dialog-box to pop up warning that an application is accessing your mailbox and asking if you want to allow it to continue.  You have to click the Yes button for the code to continue.  There are three ways around this  One, write the code as an Outlook add-in.  Add-ins have different security rules, but they are also more difficult to write.  Two, use Click-Yes (http://www.contextmagic.com/express-clickyes/).  This utility sits in the system tray and watches for that security dialog-box.  When it appears, it clicks the Yes button for you.  Three, use Outlook Redemption (http://www.dimastr.com/redemption).  This component library safely circumvents Outlook security, allowing the code to do its job.  If you want to use either of the last two, then I can modify the code to check who the message is addressed to and take action based on the result.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Const IsInsideSalesRep = True
    Dim strAddresses As String
    If Item.Class = olMail Then
        If IsInsideSalesRep Then
            strAddresses = InputBox("If this message is to a client, then enter the email address of the client's sales rep." & vbCrLf & "If there are mutliple addressees, then separate them with a a semicolon (;)", "Address to Sales Rep")
            If strAddresses <> "" Then
                If Item.CC = "" Then
                    Item.CC = strAddresses
                Else
                    Item.CC = Item.CC & ";" & strAddresses
                End If
                Item.Recipients.ResolveAll
            End If
        End If
    End If
End Sub
0
 

Author Comment

by:djinIT
Comment Utility
Thanks BDF. I'll look into the workarounds #2 and #3 to see what will work best for us. Further, I'll try out the code this afternoon and get back to you tomorrow. Thanks much for your efforst thus far.

DJ
0
 

Author Comment

by:djinIT
Comment Utility
At startup I did get the message about enabling macros. Answered to the affirmative. Wrote and replied various test emails but I don't get prompted to enter anything. Messages are sent as normal.

And to clarify, I do want this script to generate the popup dialog box when sending any email message (new or replied).
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 76

Accepted Solution

by:
David Lee earned 350 total points
Comment Utility
For some reason Outlook sometimes doesn't run macros even after enabling them.  Typically the cure for that is to explicitly run a macro.  Afterwards, Outlook appears to recognize that macros are enabled.  Add the macro below to Module1, then run it by clicking Tools->Macro->Macros, selecting this macro, and clicking Run.  All it does is create a blank message and display it onscreen.  When the message appears you can simply close it.  Then try sending something again and let me know what happens.

Sub ForceMacros()
    Dim olkItem As Outlook.MailItem
    Set olkItem = Application.CreateItem(olMailItem)
    olkItem.Display
    Set olkItem = Nothing
End Sub
0
 

Author Comment

by:djinIT
Comment Utility
I exported and then deleted all my modules so I could start fresh. That did the trick. So I'm assigning you points and an "A". I do have a couple of inquiries.

When I hit "send" at first I thought Oultook froze because the dialog box didn't pop up. I then realized the box is indeed popping up but its hidden behind the email message. Is there a way to control that and make sure its always on top? And lastly, the addresses that sender would cc to are all in our global address list. I know I'm being really picky but is it possible to have display the address list? Or maybe even have a couple default addresses display and the user can simply delete one or both address from the popup?
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
I'll check into possible ways to ensure the dialog-box appears as the foremost window.  Displaying the address list is possible, but it'd require more complicated code and possibly the creation of a user form..  
0
 

Author Comment

by:djinIT
Comment Utility
Sounds good BDF. If its easier to code two default addresses then that would definitely suffice. User could simply delete one or both. Thanks!
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
I don't know of a way to make the dialog-box the topmost window in Outlook.  Adding mutliple addresses to the dialog-box is simple though.  Simply replace the line with the InputBox command with the one below.

    strAddresses = InputBox("If this message is to a client, then enter the email address of the client's sales rep." & vbCrLf & "If there are mutliple addressees, then separate them with a a semicolon (;)", "Address to Sales Rep", "address1@company.com; address2@company.com")
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Outlook won't display email details 5 30
Outlook Archive File 3 34
Macro to Send Appointment from Excel 1 25
outlook 2013 8 26
Outlook Free & Paid Tools
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now