Lotus Notes FAQ Visit Our Sponsor!

Can you have a single URL that opens the user's mailbox?

This is from Ron Heller (hellerr@msnotes.wustl.edu):

Create a database that everyone connects to (let's call it getmail.nsf). Set the ACL -Default- and Anonymous to No Access, with all your users given Reader access (you can do this with a group or wildcard OUs) - so they must be authenticated when they hit the URL.

Set the Database Properties to "launch the designated doclink", which is a blank document (the only doc in the db) created with a form as follows:

Place a hidden Computed for Display field at the top with the name $$HTMLHead and give it the following formula (note that the column names are from the R4.5 mail template and may change in other templates):

mailFile := @If(
  @IsNotMember("$$WebClient"; @UserRoles);
  "";
  @ReplaceSubstring(@DbLookup("":"NoCache"; "":"names.nsf"; "($VIMPeople)"; @Name([Abbreviate]; @UserName); "MailFile"); "\\"; "/")
);
URL := @If(
  mailFile = "";
  "";
  @IsError(@UserAccess("" : mailFile));
  "";
  "/" + mailFile +
    @If(
      @Right(@LowerCase(mailFile); 4) = ".nsf";
      "";
      ".nsf") +
    @If(
      @IsError(@DbColumn(""; "" : mailFile; "($HeadlinesView)"; 1));
      "/$Inbox/?OpenView&Count=30&ResortDescending=2";
      "?OpenDatabase"
    )
);
@If(URL = "";
  "";
  "<TITLE>Web Mail Connect</TITLE><META HTTP-EQUIV=\"Refresh\" CONTENT=\"1;URL=" + URL + " \">"
)

Place a second, visible Computed for Display field on the form with this formula:
@If(
$$HTMLHead= "";
"Sorry: Mail file not found on this server.";
"Connecting to Mail File for " + @Name([CN]; @UserName) + @Repeat("."; 25))

When a user enters the URL http://myserver.xxx/getmail.nsf, they are prompted for UserName and Password and sent directly to their Inbox, sorted descending.


Another method using a button comes from Bill_Gordon@mgic.com:

1. Create a form anywhere and place a button on a form called My Mail with @Command([FileSave]) for the formula. Set the security to force login when accessing this document's URL or use &Login.

2. Place a hidden computed field on the form called SaveOptions and set the formula to "0" (zero in quotes). When the form is submitted it will never create a document.

3. Place a hidden computed field called MailName on the form and set its formula to @V3UserName.

4. Create an agent that is called from the WebQuerySave event of the form. The agent performs a lookup to get the user's mail file name from the name and address book, formats a return URL and uses Print to send it back to the browser. See example below:
Set db = session.CurrentDatabase
Set nabdb = New NotesDatabase( db.Server, "names.nsf" )
Set doc=session.DocumentContext
strng = "Form = 'Person' & FullName = '" & doc.MailName(0) & "'"
Set collection = nabdb.Search ( strng, dateTime, 0)
If collection.count = 0 Then
address = "[" & "https://servername/database.nsf/viewname/WebError?OpenDocument" & "]"
Else
Set persondoc = collection.GetFirstDocument
address = "[[" & persondoc.MailFile(0) & ".nsf]]"
End If
Print address

5. An error form, WebError, was also created in the database. If the logged in user does not have a mail database the error form is displayed.


Applies to Notes Versions: 4 4.5 4.6 5
Last Modified: August 29, 1999