Solved

Alerting Users about the Maximum Outgoing Email Size

Posted on 2003-11-19
10
493 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
10 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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
Comment Utility
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
Comment Utility
oh and for the multiple mail databases - you can propagate your changes using template.
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:damrakandy
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Once you have the calendar profile - or a profile of your own making -- you can save the max size value there.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now