Classify the incoming and outgoing e-mail of several POP3 accountusing several pc in LAN

V

VT @ home

The environment.
Five clients with Win Xp Pro, linked to a LAN with a primary domain Win
Server 2008 standard.
Two of the clients have Outlook 2003.
Three of the clients have Outlook 2007.

Every user has an unique account defined on the server and can make
login on every pc but can make login only on one pc at any time.

The need.
One of the users needs to manage the incoming and the outgoing e-mail of
three different POP3 accounts.
The user needs to do that using any of the pcs.

My solution.
On every pc I created an Outlook profile and configured the three
different e-mail accounts.
Then I linked to the above mentioned Outlook profile three different pst
files (one for each e-mail account).
The pst files reside in a shared folder of the server with R/W permissions.
At the end I defined several rules in the Outlook profile to move the
incoming and outgoing mail in the corresponding pst file, choosen using
the sender address (for outgoing mail) or the recipient address (for
incoming e-mail).

This solution have never worked fine and at the end it stopped working
because, as I could verify last week, the rules disappeared !

The user says that she didn't do anything and I can trust her.

So I thought that VBA would be safer and I wrote the following code:

Option Explicit
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Call Smista("Out")
End Sub

Private Sub Application_NewMail()
Call Smista("In")
End Sub

Public Sub Smista(pTipo As String)

On Error GoTo Err

Dim objOlApp As Outlook.Application
Dim objSourceNameSpace As Outlook.NameSpace
Dim objSourceFolder As Outlook.MAPIFolder, objMsg As MailItem

Dim objDestNameSpace As Outlook.NameSpace
Dim objDestFolder As Outlook.MAPIFolder, objNewMsg As MailItem
Dim i As Long

' Crea un oggetto di tipo Outlook
Set objOlApp = CreateObject("Outlook.Application")
' Recupera il namespace di tipo MAPI
Set objSourceNameSpace = objOlApp.GetNamespace("MAPI")

If pTipo = "In" Then
' Recupera la cartella della posta in arrivo
Set objSourceFolder =
objSourceNameSpace.GetDefaultFolder(olFolderInbox)
End If
If pTipo = "Out" Then
' Recupera la cartella della posta inviata
Set objSourceFolder =
objSourceNameSpace.GetDefaultFolder(olFolderSentMail)
End If

' Recupera il primo messaggio nella cartella sorgente
Set objMsg = objSourceFolder.Items.GetFirst

' Cicla sui messaggi nella cartella sorgente
For i = 1 To objSourceFolder.Items.Count

Set objMsg = objSourceFolder.Items.Item(i)
If pTipo = "In" Then
' Imposta la cartella di destinazione
If InStr(1, LCase(objMsg.Recipients), "becucci") > 0 Then
Set objDestFolder = objSourceNameSpace.Folders("Dr.
Becucci").Folders("Posta in arrivo")
End If
If InStr(1, LCase(objMsg.Recipients), "simone") > 0 Then
Set objDestFolder = objSourceNameSpace.Folders("Dr.
Simone").Folders("Posta in arrivo")
End If
If InStr(1, LCase(objMsg.Recipients), "minigrilli") > 0 Then
Set objDestFolder = objSourceNameSpace.Folders("Dr.ssa
Minigrilli").Folders("Posta in arrivo")
End If
End If
If pTipo = "Out" Then
' Imposta la cartella di destinazione
If InStr(1, LCase(objMsg.SenderEmailAddress), "becucci") > 0 Then
Set objDestFolder = objSourceNameSpace.Folders("Dr.
Becucci").Folders("Posta inviata")
End If
If InStr(1, LCase(objMsg.SenderEmailAddress), "simone") > 0 Then
Set objDestFolder = objSourceNameSpace.Folders("Dr.
Simone").Folders("Posta inviata")
End If
If InStr(1, LCase(objMsg.SenderEmailAddress), "minigrilli") > 0 Then
Set objDestFolder = objSourceNameSpace.Folders("Dr.ssa
Minigrilli").Folders("Posta inviata")
End If
End If

' Crea una copia del messaggio
Set objNewMsg = objMsg.Copy

' Sposta la copia del messaggio nella cartella di destinazione
objNewMsg.Move objDestFolder
objMsg.Delete
Next i

Set objMsg = Nothing
Set objNewMsg = Nothing
Set objOlApp = Nothing
Set objSourceNameSpace = Nothing
Set objSourceFolder = Nothing
Set objDestFolder = Nothing

Exit Sub

Err:
If Err.Number <> 0 Then
Debug.Print Err.Description & vbCrLf & i & " - Data: " &
objMsg.ReceivedTime
Resume Next
End If
End Sub

This code works only on the clients with Outlook 2003; in Outlook 2007
it's not executed.
I set a breakpoint on Call Smista("Out") then I sent a message, but the
code didn't stop; so I think it never started !
The same happened (better: nothing happened !) when I received a message.

My questions are:
- why does the code work only in Outlook 2003 ?
- is the solution correct and, if the answer is negative, what else
could I try ?

Please don't suggest the purchase of Exchange: is too expensive for my
customer.

Thanks in advance to everybody who will answer.
 
D

Diane Poremsky [MVP]

The solution probably never worked right because network access of the pst
files is not supported. You need a real sharing solution or a local imap
server and a pop connector to place the mail in the imap server. SBS server
may be an affordable solution.

There tools at http://www.slipstick.com/outlook/share.asp or google for imap
servers - there are some reasonably priced imap servers.

--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
mailto:[email protected]

EMO - a weekly newsletter about Outlook and Exchange:
mailto:[email protected]
 
B

Brian Tillman [MVP - Outlook]

I know that, but I thought that "network access of the
pst files is not supported" meant that concurrency (shared access) is not
supported, not that I can't put the pst files in a network folder !

It's more than that. Network access uses different I/O than local access,
according to Microsoft, and that difference can lead to PST corruption.
I put them on the server just because in my case the pst files are used by
one user only who needs to use them working on any of the five clients.
Isn't it like if the pst files were in the local hard disk ?

Not really.
 
D

Diane Poremsky [MVP]

By not supporting it, they mean you are on your own if you suffer data
loss - you can't badmouth MS because they specifically said its not
supported. :)

User access is part of it but network traffic is a bigger part. If you lose
connectivity, the pst can be toasted if outlook is using it. A lot of
people don't have problems and with light network traffic, it may be fine.
Unless you have a 10baset network and the other employees are downloading
videos all day, one person using 1 pst might be ok. I would avoid wireless
connections because you lose connectivity more frequently with wifi.

My own son is ignoring his mother's advice and sharing a pst over a network
at work. They set outlook to unlock the pst quickly so the other person can
access it. This may help you - outlook can hold it open for a long time.
(http://www.slipstick.com/emo/2009/up090212.htm#4)



--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
mailto:[email protected]

EMO - a weekly newsletter about Outlook and Exchange:
mailto:[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top