Issue: 
You have a local application running, and you need to either: 
1. Compose an e-mail message in the mail file. 
2. Switch to the closest / fastest replica of the user's home mail server. 
 
Note: For #2 above, the local notes.ini / preference file is used. The mail file opened might still be a LOCAL replica. In which case, this doesn't directly help you. 
If you still get a local replica, you need to also get the Administrative Server for the mail file to get the home mail server. 
 
Sample Solution Functions: 
The first function below gets the local mail file (whose server could be still "" for local). 
 
Function GetUserMailApp(s as NotesSession ) As NotesDatabase 
    Dim mailDb As New NotesDatabase("", "") 
     
    On Error Goto FErrorHandler 
     
    ' get mail app 
    Call mailDb.OpenMail 
    Set GetUserMailApp = mailDb 
FExit: 
    Exit Function 
     
FErrorHandler: 
    Set GetUserMailApp = Nothing 
    Resume FExit: 
End Function 
 
 
The second function below gets the local mail file, and if local, get's the administrative server. 
 
Function GetUserMailSvr (s as NotesSession ) As String 
    ' notes:  
    ' - returns mail server name as canonical string 
    ' - may still return "" as server name if local mail replica doesn't have an admin server 
     
    Dim mailDb As New NotesDatabase("", "") 
    Dim mailACL as NotesACL 
     
    On Error Goto FErrorHandler 
     
    ' get mail app 
    Call mailDb.OpenMail 
    If (mailDb Is Nothing) Then 
        GetUserMailSvr = "" 
        Exit Function 
    Else 
        ' check server 
        If Not (mailDb.Server = "") Then 
            ' on server, return current db server 
            GetUserMailSvr = mailDb.Server 
        Else 
            ' local, get admin servername 
            Set mailACL = mailDb.ACL 
            GetUserMailSvr = mailACL.AdministrationServer 
        End If 
    End If 
     
FExit: 
    Exit Function 
     
FErrorHandler: 
    GetUserMailSvr = "" 
    Resume FExit: 
End Function 
 
 
  
previous page
 
  |