Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

moving messages from sent items to each IMAP account's sent items

Status
Not open for further replies.

cadocs

Technical User
Jun 16, 2005
35
US
Hey guys,

I am a little frustrated with Outlook. I currently use outlook express for all my emailing and am looking into switching to Outlook 2003 because i have lots of VBA code in excel to compose emails and it is just easier with outlook, but i have one big problem... every time i send an email from an account (i have like 20 different IMAP accounts installed) oulook always saves the email to the "sent Items" folder in personal folders (local folder). In outlook express, if you sent an email from account #2, it would save the message into sent items in account #2.

I have looked all over the web for a solution or VBA code to fix this. I already tried to set up a rule to send the message to the correct sent items folder and it works when i have an IMAP account that i'm accessing from my hosting company, but it doesn't work for our local IMAP accounts...I have set up a local mail server for our company on my computer so that all our computers access their emails via IMAP on our local system.

I can't believe that other people haven't been frustrated with this problem too because it is very anoying.

I also found the following code which prompts you to select the folder you want the message to be saved to after you send it, but it doesn't work either.

Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
End Sub
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If TypeName(objFolder) <> "Nothing" And _
IsInDefaultStore(objFolder) Then
Set Item.SaveSentMessageFolder = objFolder
End If
Set objFolder = Nothing
Set objNS = Nothing
End Sub

Public Function IsInDefaultStore(objOL As Object) As Boolean
End Function
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objInbox As Outlook.MAPIFolder
On Error Resume Next
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Select Case objOL.Class
Case olFolder
If objOL.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case olAppointment, olContact, olDistributionList, _
olJournal, olMail, olNote, olPost, olTask
If objOL.Parent.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case Else
MsgBox "This function isn't designed to work " & _
"with " & TypeName(objOL) & _
" items and will return False.", _
, "IsInDefaultStore"
End Select
Set objApp = Nothing
Set objNS = Nothing
Set objInbox = Nothing
End Function


Any help would be awesome.

Geoff

 
Just to clarify...

my incoming mail settings for my hosting company are mail.cadocsigners.net and for my local server 192.168.0.109

Both outgoing servers are set to mail.cadocsigners.net

hope this clarifies a little bit.

geoff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top