Solved

Alerting Users about the Maximum Outgoing Email Size

Posted on 2003-11-19
10
497 Views
Last Modified: 2013-12-18
Hi experts,

   I am just writing a simple code to notify users if their currently editing emails' sizes are over the maximum outgoing email size that is set in the domino server.  I put the following code in the QuerySave event of Memo, Reply, and Reply with History forms:

'disallow save if document size is over 7340032 bytes
      
If source.document.size > 7340032 Then
            Continue = False
            sorrymsg = "Sorry! The size of email exceeds the maximum limit."
            exceedinKB = (source.document.size -7340032) / 1024
            Msgbox( sorrymsg+"  It is about " + Str(Int(exceedinKB)) + "KB over the maximum limit.")
      End If

The codes works fine, but it becomes titeous if I want to change the number 7340032 to something else, then I have to change that in all Memo, Reply, and Reply with History forms in all email databases.  

  Is there a way to reference the max outgoing email size value of the domino server using LotusScripts?


thanks,
Andy
0
Comment
Question by:damrakandy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 9777213
You could try to locate the applicable Configuration document (either secific or default configuration) in the N&A-book, get the field RouterMaxMsgSize and use it.
0
 
LVL 2

Expert Comment

by:ksi2001
ID: 9779820
you need to create a script library with a function getMaxMessageSize() As Long

declare script library in your code like

Use "scriptLibraryMentionedAbove"

If source.document.size > getMaxMessageSize() Then
 ........

inside the function you can either return your constant or use the value from configuration document as sjef suggests.  So there will be only one point where you will change you code if logic changes.
0
 
LVL 2

Expert Comment

by:ksi2001
ID: 9779836
oh and for the multiple mail databases - you can propagate your changes using template.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 31

Expert Comment

by:qwaletee
ID: 9783984
What I would do is create a script that runs on all your server, and nightly pushes the max size setting configured for your server into the user's mal file Calendar Profile.  Once it is there, the mail file code can easily do an internal retrieve.  The design never changes... it is just a bit of data.

If you need help writing the code, let me know.
0
 

Author Comment

by:damrakandy
ID: 9815448
Hi,

  thanks all for the help.  It seems that qwaletee's suggestion would be the best.

qwaletee,

   I have never written a server script before.  where should I start?  please help.  

thanks,

andy
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 50 total points
ID: 9815528
Have you written LotusScript at all?  Create a database on the server, and create a LotusScript agent that yuo will, at first, run manually (runs from Action menu).

Here's some example code that will retrieve a server's maximum message size:

Dim s as new notesSession
Dim thisDB as notesDatabase
Dim server as string
Dim directory as notesDatabase
Dim configView as notesView
Dim configDoc as notesDocument
Dim serverName as notesName
Dim maxSize as Long

Set thisDB = s.currentDatabase
server = thisDB.server

serverName = s.createName(server)
server = serverName.canonical 'make sure we have it in CN=Server/O=xyzyz format, since that's how the view stores it

Set configView = directory.getView(  "($ServerConfig)"   )
Set configDoc = configView.getDocumentByKey(server)
If doc is nothing then
  'not found; maybe server still cam back as a flat name?
  Set configDoc = configView.getDocumentByKey("CN=" & server) 'partial match here?
End if
If doc is nothing then
  'not found; maybe server still cam back as a flat name?
  Set configDoc = configView.getDocumentByKey("*" , True) 'fall back, use default config doc
End if


maxSize = configDoc.routerMaxMessageSize(0)
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9815557
We also need code that will go out to every mail file on the server...

Dim serverUsersGlobal as notesView
Dim serverUsers as notesViewEntryCollection
Dim user as notesViewEntry
Dim mailFilePath as String
Dim mailFile as notesDatabase
Dim profile as notesDOcument

Set serverUsersGlobal = directory.getView("MailUsers")
Set serverUsers = serverUsersGlobal.getAllEntriesByKey(server)
If serverUsers.count = 0 then
  'not found; maybe server still cam back as a flat name?
  Set serverUsers = serverUsersGlobal.getAllEntriesByKey("CN=" & server) 'partial match here?
End if
Set user = serverUsers.getFirstEntry
Do Until user Is Nothing
  mailFilePath = user.columnValues(4)
  Set mailFile = s.getDatabase(server,mailFIlePath)

  Set profile = mailFile.getProfileDocument ( "CalendarProfile" )

  Set user = serverUsers.getNextEntry(user)
Loop
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9815559
Once you have the calendar profile - or a profile of your own making -- you can save the max size value there.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Querying received e-mails from an agent 7 209
How to automate deletion of content in Lotus Notes mailboxes 3 231
Lotus Domino Server Failure 1 198
Domino Lotus Notes Client 4 73
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question