[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 503
  • Last Modified:

Alerting Users about the Maximum Outgoing Email Size

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
damrakandy
Asked:
damrakandy
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
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
 
ksi2001Commented:
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
 
ksi2001Commented:
oh and for the multiple mail databases - you can propagate your changes using template.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now