Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problems sending email with correct account

Posted on 2006-11-09
9
Medium Priority
?
247 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

609 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