ShowTable of Contents
Introduction
Lotus Domino is a robust and scalable platform that can be used for the mail messaging requirements of an enterprise. A Domino administrator has different options to choose from when assigning a mail client to the end user; for example, the following types of clients are configurable with the Domino mail server:
- IBM Lotus Notes® clients
- IMAP clients, such as Microsoft® Outlook Express
- POP3 clients
- Lotus iNotes®
- IBM Lotus Domino Access for Microsoft Outlook clients (last release was 8.0.2)
The default mail template supplied with Lotus Domino can be customized by use of Lotus Domino Designer per the requirements of an organization. This article builds upon this facility, explaining how you can customize the underlying code and design elements to automatically zip attachments, on the fly, in an outbound mail message.
The template used here is version 8.5.1, but the same code will also work on earlier versions, including V7 and V8, though there will be a difference in the line numbers in the script library. This article addresses only the following use cases:
- Lotus Notes clients
- Lotus iNotes
Setting up the environment
This section explains the development and server environments necessary to deploy the solution.
Server component
Table 1 shows the server-side component used.
Table 1. Server components
Component / Server name | Purpose |
Lotus Domino 8.5.1 | Used for authentication, authorization, and mail messaging service |
Development tools
Table 2 shows the development tools used.
Table 2. Development tools
Component name | Purpose |
Domino Administrator | Used to administer and configure Lotus Domino |
Domino Designer | Used to customize the Domino mail template |
Client tools
Table 3 shows the client components used:
Table 3. Client tools
Component Name | Purpose |
Lotus Notes | Used to access client-based mail template |
Web Browser | Used to access browse- based mail template |
Server component setup
Refer to the
Lotus Domino and Notes Information Center for the steps to install Lotus Domino Enterprise Server 8.5.1.
Development environment setup
For releases earlier than 8.5.2
Perform the following steps to set up the Domino environment:
- Download the files from the Attachments section of this article.
- Sign the databases using the ID of the Domino Administrator of your Domino server.
- Copy the zipmail85.ntf file to the Data directory of your Domino server.
- Copy the Forms85.nsf file to Data/iNotes directory of your Domino server (keep a copy of the original file in this directory).
For release 8.5.2
Perform the following steps to set up the Domino environment:
- Download the files from the Attachments section of this article.
- Sign the databases using the ID of the Domino Administrator of your Domino server.
- Copy the zipmail85.ntf file to the Data directory of your Domino server.
- Copy the Forms85.nsf file to Data/iNotes directory of your Domino server (keep a copy of the original file in this directory).
- Copy the Forms85_x.nsf file to Data/iNotes directory of your Domino server (keep a copy of the original file in this directory).
Customizing the mail template for Notes client users
The design of the Domino mail template is stored in Mail85.ntf, which can be found in the Data directory of the Domino server.
Modified design elements
For our solution we modify the following design elements of this template:
- Memo, Reply, and Reply with History form
- CoreEmailClasses script library
- Send, Send and File, Save as Draft shared actions
New design elements
We also modify the following design elements of this template:
- ZipDir script library
- (AttachDrafts) view
- Exit shared action
Changing the forms
Make the following changes in the Memo, Reply, and Reply with History forms:
Mail Send dialog box. Disable the
“Present mail send dialog” option in the Defaults tab for On Close in all three forms mentioned above (see figure 1).
Figure 1. Disable “Present mail send dialog”
New fields. Add these three new fields: SaveOptions, EscCheck, and HasDraft.
Queryclose event. Add the code in listing 1 at the second line in the Queryclose event of the above-mentioned forms.
Listing 1. Code to add to Queryclose event
This code is added to override the default functionality whereby users can close the form using the Esc button or the File > Close option.
Postopen action. Add the code in listing 2 at the third line in the Postopen event of the forms.
Listing 2. Code to add to Postopen event
New shared action. Add the new action, “Exit,” to the three forms, to enable users to close the document.
Changing the Shared Actions
Save as Draft. Add the code in listing 3 to this shared action.
Listing 3. Code to add to Save as Draft action
Send. Add the code in listing 4 to this shared action.
Listing 4. Code to add to Send action
Send and File. Add the code in listing 5 to this shared action.
Listing 5. Code to add to Send and File action
All the changes in the shared actions are made to cater to the new fields that have been added. In the case of the Send and the Send and File actions, additional code is added to simulate the default functionality that's been overridden as a result of changes made in the script.
Changing the CoreEmailClasses script library
The changes described in this section are at the core of the solution.
Options section. Add the following code to this section:
Declarations section. Add the code in listing 6 to this section.
Listing 6. Code to add to Declarations section
New Function. Add the new function, “detachattachment,” to the script library. This function contains the code that detaches the attachments from the mail in a folder, zips the folder, reattaches the zip file, and then removes the temporary files from the user's machine.
- This function uses the new ZipDir script library to zip the files and is called at three places just before the existing Mail Send function is called. The line numbers in the modified library in the attached template where this function is called are 609, 648, 687.
- ZipDir script library. This new script library is a Java library containing the code to zip the attachment folder and is called by the detachattachment function.
- AttachDrafts view. This view is used by the new detachattachment function code.
Exit shared action. This new action is included in the forms and enables users to exit the current document (see listing 7).
Listing 7. Code for Exit shared action
The UI for iNotes users is generated from the database Forms85.nsf, located in the Data/iNotes directory of the Domino server.
Customizing the mail template for iNotes users
Changing Forms85.nsf for releases earlier than 8.5.2
Modification to s_MailMemoDictionary Subform. Add the following code as the first line of the subform, inside the new set of
tags:
<NOTESVAR NAME={$$QuerySaveAgent} VALUE={"(WebZipFiles)"}>
This enables the required QuerySave agent to be called.
Modification to l_MailMemoEdit Subform. Add the following code as the first line of the subform:
<input type="hidden" name="$$QuerySaveAgent" value="(WebZipFiles)">
Changing Forms85.nsf for release 8.5.2
No change is required in this database.
Changing Forms85_x.nsf
Create a new database on the server Forms85_x.nsf in the iNotes directory, using the Lotus iNotes Extension Forms template.
Modification to Custom_MailMemoDictionary_Lite Subform. Add the following code in the subform:
<NotesDictionary>
<NOTESVAR NAME={$$QuerySaveAgent} VALUE={"(WebZipFiles)"}>
</NotesDictionary>
NOTE: Remember to take care of the commented code inside the subform. You can remove it or leave it as is.
Changing the mail template
For release 8.5.2, in the (WebZipFiles) agent inside the mail template, replace these lines of code at the end of the agent:
Print |<script>|
Print |window.close();|
Print |parent.CwX();|
Print |</script>|
with these:
Print |<script>|
Print |try{var DhU=window.frameElement.DhU; setTimeout(DhU.DlJ.EHq(DhU), 0);} catch (e){}|
Print |parent.CwX();|
Print |</script>|
Other changes
iNotes_WA_QueryAgents=1. Add this parameter to the server's Notes.ini file so that the WebQuerySave agents will run for iNotes users.
Additional recommendations/considerations
Implement a Desktop Policy setting for all users with the new template to have their Sent mails save option set to “Always.” This is to keep in synch with the new code, which always saves the mail to the Sent folder.
Pros and cons of the solution
Following are the benefits provided by this solution:
- Disk space savings
- Less data flow through the server
- Less frequent mailbox capping
Following are the trade-offs of the solution:
- Each Web user will have an agent running on the server, so the administrator must take care of the additional load on the server.
- Also, there will be a couple of changes in the user experience; for example, users won't be able to use the 'Esc' button or the File > Close option, to close a mail document.
Conclusion
This article has explained how you can customize Lotus Domino, for either Notes client users or iNotes users, to auto-zip all mail attachments. Using the solution described here, users can save large amounts of disk space and can minimize the risk of exceeding the mail quotas.
Resources
Learn
Refer to the
Lotus Domino Info center:
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp
Refer to the
Lotus Domino documentation:
http://www.ibm.com/developerworks/lotus/documentation/domino/80x.html?S_TACT=105AGX28&S_CMP=DLMAIN
Lotus Domino wiki:
http://www-10.lotus.com/ldd/dominowiki.nsf
Get products and technologies
Try
Lotus Domino:
http://www-01.ibm.com/software/in/lotus/try-it-center/index.html?wm=700001f2671&cm_sp=CT601-_-SWB40-_-2671
Discuss
Participate in the discussion forum:
http://www.ibm.com/developerworks/forums/forum.jspa?forumID=782
About the author
Abhishek Jain has worked with IBM India Software Labs since 2004 and has been in the industry for more than eight years. He currently works as an IT Specialist with Lotus Lab Services and is skilled in various Lotus technologies, namely, Domino, Sametime, Quickr, and Connections. He has considerable experience in, and is certified on, both Lotus and Java/J2EE technologies. You can reach Abhishek at
abhi.jain@in.ibm.com.