41 comments on “Verifying the Account Outlook is Sending Through

  1. Hi David, I am sorry for this maybe stupid question but I am a total rookie to VBA: Which parts of code do I have to edit to get the macro to work? Thanks a lot, Mary

    • Hi, Mary.

      This code does not require any editing. All you need to do is follow the instructions for your version of Outlook.

    • Hi David,

      First of all thanks for all your work.I have 2010 office and i tried the code snippet revision but have not had any luck.I want to have a popup if i am not sending the email from my email address i.e i should get a pop up whenever i reply via shared mailbox.

      Thanks in advance
      Regards,
      Rahul

    • Hi, Rahul.

      You’re welcome!

      What does “shared mailbox” mean in this context? If you open a sent item that was sent via the shared mailbox, what address does it show for the sender?

  2. Thank you for this clean and simple solution. I searched all over the web for this type of prompt and yours worked first time right out of the chute. BTW, I am not a programmer or very techie at all. The instructions were great with one exception: The Trust Center is under Tools in my 2007 version of Outlook. All else was perfect and an elegant solution.

    Cheers!

  3. David,

    Any chance of you helping me get this code onto my computer remotely? It does not seem to be working for me.

    Richard

    • Hi, Richard.

      Possibly. Tell me a little about your environment. What version of Outlook are you using? Have you enabled macros? Are you getting any error messages?

    • Hi David,

      Outlook 2007. I did what you suggested in your instructions and the macro did not take for some reason. I am not a computer “buff” so it might be just a simple fix. If we could set up a time I would let you get on my PC through Team Viewer and you could do this as I haven’t got the time to spend troubleshooting.

      I enabled macros and did not get any error message. I tried sending a couple of test e-mails and they went out as usual with no pop up alert.

      Let me know if you are available to give it a try remotely.

      Thanks

      Richard

    • Sure David. How does Wed or Thursday Aug 22 or 23rd look for a noon call? Also would you like to call me or shall I call you? Lastly before I give you my phone number I want to make sure it does not go out on your “public” site post. Please advise if this reply is going directly to you or can others read it.

      Thanks

      Richard

  4. Hi David. I am getting a Compile Error: Ambiguous name detected: Application_ItemSend – when I send any email now. It opens the code page expecting a fix. Do you know what I can do to resolve this? Thanks!

    • The error is telling you that there’s already a procedure there called Application_ItemSend. You’ll need to merge the code from the two procedures into one procedure.

    • Thanks David. When I start Outlook now, the macro warning doesn’t show anymore, but the settings are correct to have it show when launching Outlook. Any ideas? I really appreciate your wisdom David! Thanks.

    • I have inserted the code into the other procedure and compiled with no errors. However, after restarting Outlook, (and manually enabling macros with alt + f11), when I send an email, I do not get the opportunity to select an account to send from. Should I email you the code I am using? Thanks David.

    • Hi, mannagod7.

      Sure, email me the code (in a text file attachment, please) and I’ll take a look. What version of Outlook are you using?

  5. David – This is great. I have 3 differrent accounts in 2010, 2 pop & 1 Exchange. My only issue is that I used the 2nd code sample and it prompts me for all accounts. Even if I send from my default account it still prompts me. Do I need to customize the 2nd snippet?
    Thanks

    • Hi, Kirk.

      Thanks!

      By “2nd code sample” I assume you mean the code in Revision 1. If so, then the reason the code is prompting you on every message you send has to do with how Exchange works internally. Exchange uses X.400 addressing internally. That means the code is comparing your X.400 address to your SMTP address which, of course, doesn’t make for a match. The solution is to edit line #15 of the code. Change it to

      If strAccount <> Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtoAddress Then
      

      Now the code will compare an SMTP address to your primary SMTP address which should mean that you aren’t prompted when sending a message through the default, Exchange, account.

    • Thanks David.

      Actually one of the POP accounts is my main account. I’ve gotten used to it prompting for all accounts so I think I like it as is.
      Thanks again for your time.
      Kirk

  6. Neat script. Is it possible to only have the dialog box pop up when trying to send from an account other than the default account? My problem is 98% of the time I am and should be sending from the default account. Its the stray email that came in unnoticed, to a different account, that I need to be concerned with when replying.

    P.S.- On my outlook 2007, I needed to select Tools:Trust Center (vs. File:Options:Trust CEnter: Trust Center Options per the instructions).

    • Thanks, Hugh.

      The answer is yes. I added a revision to the post (it’s at the bottom) showing how to do this.

  7. Hello David

    This is exactly what I’m looking for, and it’s all working except for when I send a meeting request out (which is one of my problems – I’m always sending meetings from the wrong account!).

    When I send a meeting request it fails with a “Object doesn’t support this property or method” error. It;s failing on the “Item.SendUsingAccount”.

    How can I modify this code to also work with meeting requests?

    Thank’s in advance for any assistance you can provide

    Charlie

    • Charlie,

      I’ve modified the code to work with meeting requests. Please replace the code you downloaded earlier with the current version. Give it a try and let me know if that fixes the issue.

      Cheers!

  8. Good morning David,

    You really don’t have to apologize, I mean : who still use office 2003 nowadays ?
    If you can come up with a solution for 2003 that would be indeed great but there is no hurry.

    I really apreciate, so want to thanks again for your time.

  9. Hello David,

    First, thanks a lot for your script it’s is exactly what I need.

    Outlook and exchange 2003 in the compagny… several mail box by users and they always send mail via the main account and that ‘s quite bad…

    I know nothing about VB :

    So I follow the instruction and copy the code in “this outlook session” and save it but when I try to send mail I always get :
    erreur 438
    Propriété ou methode non gérée par cet object.

    I did not modify anything in the script to be sure to not screw it.

    Outlook is 2k3 SP3 –> french version
    VBA is version 6.3

    Did you know what is happening ?

    • Hi, Elisa.

      The error is a result of your version of Outlook. Outlook 2003 doesn’t support the SendUsingAccount property. That was added in Outlook 2007. I apologize for the confusion. I should have indicated in the post that this was only for Outlook 2007 and later. It may take a few days, but let me see if I can come up with a solution for 2003.

  10. Pingback: Reminding Users to Include "from" field

  11. Rather than nag the user to select the account (as this script does), do you know of a way to programmatically set the account?

    Outlook is able to receive mail from multiple POP3 accounts into one Inbox and reply using the appropriate account, but with IMAP it creates an Inbox per account which is unwieldy (Gmail manages to handle multiple IMAP inputs to a single Inbox somehow). If I transparently redirect multiple accounts to a single IMAP inbox which I then collect using Outlook, Outlook sends everything through the IMAP account, even when I create send-only accounts (POP3/SMTP with retrieval disabled in Send/Receive Groups) corresponding to the other addresses.

    I’ve seen one approach which hooked the NewMailEx event and used the Redemption library to change the Account property of incoming MailItems (which should in effect be similar to receiving emails through a POP3 account and then moving them into the IMAP inbox), and another which hooked the MailItem.Reply event to set the correct sender using SetSendingAccount, but both were written for previous versions of Outlook and I haven’t been able to get them to work under 2010.

    • Hi, Anthony.

      Oops! You found an error in my instructions. ThisOutlookSession is where the code belongs and where the instructions should have told you to put it. I’ve modified them to correct that error. Sorry about that!

    • Hi, Thomas.

      Yes, that’s possible. I’ve posted my solution to the question on EE. I’m BlueDevilFan there.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s