Solved

Problems sending email with correct account

Posted on 2006-11-09
9
236 Views
Last Modified: 2008-01-16
I have a macro that I have developed based on another users post.  I set up this macro on my machine and on another employees machine.  It basically forces an email to use a certain email account.  We have 3 accounts.  cumberland.com, gilmore.com, and our Exchange.  SBS2k is the name of our exchange server and is what we use for the outgoing smtp field.  Both this user and myself have all of these accounts listed in our exchange profile.  Both of our outlook account listings show: Gilmore (default), Cumberland, exchange (in that order).  When I send a message using Gilmore or cumberland it sends it correctly.  When he sends a message, it is only received as @gilmore.com.  If he doesn't use this macro, but rather manually creates a new message and selects account, it sends fine.  This problem is driving me crazy as I cannot find a solution.  The message in his mailbox says it was sent using Cumberland, but the recipient sees Gilmore.  Below is the Macro

Sub CreateNewMessage_Gilmore()

Dim olMessage As MailItem
Dim objFSO As New FileSystemObject
Dim objFile As TextStream
Dim strBuffer As String
Dim olkSendThroughBtn As Object
Dim olkSendAccount As Object
' Set the send-from to the Gilmore account
    'olMessage.SentOnBehalfOfName = "rclark@gilmore.com"<-- this is commented out now since I figured it isn't needed...ok?
    olMessage.Display
    Set olkSendThroughBtn = Application.ActiveInspector.CommandBars("Standard").Controls(3)
   
    ' Set the control index based on the position of the Gilmore account in the
    ' order of send through list.
    Set olkSendAccount = olkSendThroughBtn.Controls(2)
   
    olkSendAccount.Execute
0
Comment
Question by:clarkrobertj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 17937356
Hi, clarkrobertj.

That looks like a macro I wrote.  I can't think of an explanation for the behavior you're describing other than having the accounts in a different sequence, but you've already ruled that out.  Let me see if I can think of a test to help determine what's going on here.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 18382525
clarkrobertj,

Sorry, I lost track of this question.  Are you still interested in pursuing a solution?
0
 

Author Comment

by:clarkrobertj
ID: 18385376
It would be nice, but... I know it is difficult, so... It is up to you.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 76

Expert Comment

by:David Lee
ID: 18418295
Ok, let's try the code below.  It reads the selections on the Accounts pull down menu.  Follow these instructions to use this.

1.  Copy the code and paste it into Module1 in the Outlook VBA editor.
2.  Create a new message.  No need to fill in any of the fields, we just need a new message open on screen.
3.  Run the macro.  A dialog-box will pop up when it finishes showing the account choices available.  Please let me know what they are.

Sub EnumerateSendThroughButtons()
    Dim olkSendThroughBtn As Object, _
        olkButton As Object, _
        intCounter As Integer, _
        strResult As String
    Set olkSendThroughBtn = Application.ActiveInspector.CommandBars("Standard").Controls(3)
    For intCounter = 1 To olkSendThroughBtn.Controls.Count
        Set olkButton = olkSendThroughBtn.Controls.Item(intCounter)
        strResult = strResult & "Item #" & intCounter & " = " & olkButton.Caption & vbCrLf
    Next
    Set olkButton = Nothing
    Set olkSendThroughBtn = Nothing
    MsgBox strResult
End Sub
0
 

Author Comment

by:clarkrobertj
ID: 18566634
Sorry --  I got up doing other things and lost track of this. I pasted the code into module 1 as you suggested.  The following screen appears:
Item#1 = mail.gilmorefurnitureinc.com
Item#2 = &1 mail.gilmorefurnitureinc.com
Item#3 = &2 mail.cumberlandfurniture.com
Item#4 = &3 Microsoft Exchange Server
0
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
ID: 18575897
Either of these lines

    Set olkSendAccount = olkSendThroughBtn.Controls(1)
    Set olkSendAccount = olkSendThroughBtn.Controls(2)

should send through the Gilmore account.  This line

    Set olkSendAccount = olkSendThroughBtn.Controls(3)

should send through the Cumberland account.  Does neither one work properly?
0
 

Author Comment

by:clarkrobertj
ID: 18578191
Thanks for all your help.  After I posted your last section of code I noticed that the user had over 15,000 emails in his inbox.  I also noticed that they had a similiar quantity in their deleted items and sent items folders as well.  I then archived his folders (and created an archive file of over 2.5 GB!)  Afterward, it appeard that everything was working correctly.  I am going to chaulk it up to an overloaded email account.  Regardless -- I am awarding you the points for your hard work.  Thanks!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 18584531
Wow, that's a lot of email.  Glad you got it working.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Outlook Free & Paid Tools
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
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…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

733 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