Solved

Problems sending email with correct account

Posted on 2006-11-09
9
231 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
  • 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Create high volume marketing opportunities using email signatures with these top 10 DOs and DON'Ts of email signature marketing.
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
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…
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 …

746 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

12 Experts available now in Live!

Get 1:1 Help Now