Domino限制附件大小设置
Domino 技巧:如何限制附件大小
大家应该知道,现在的免费(或收费)邮箱,一般都有限制附件大小的功能,当某些附件超过一定容量后,就不能发送,其实Domino Server也有同样的功能,而且设置非常简单。
首先,我们合用Domino Administrator打开我们的Domino Server,选中在最右边的Configuration Tab,选中Server -> Configuration ,选择编辑当前服务器的Configuration Document.
在Configuration Document 中的Router / SMTP -> Restriction and Controls -> Restriction中有一这可以设置Maximum message size,只需要在这里指定允许的最大附件容量即可。
建议不要将附件容量设的太大,不然用户的邮箱可能会很快的增肥.
此方法在Domino R5 & R6下试验通过,设置完成后,需要重新启动Domino Server,或直接使用更新命令。
Domino Server可以设置某些附件较大的邮件,在空闲的时候再发送,其实设置就是限制附件的大小。
我们可以在Send all messages as low priority if message size is between:进行设置。
还没有完成设置呀......
修改用户邮件模板方法来控制附件大小:
相信作为网管的兄弟姐妹们跟我一样,为了限制附件的大小伤透脑筋!如果在服务器的配置文档中来设置,一是在一台服务器的内部是不生效的,二是多台服务器时,即使生效,会产生大量的大附件邮件滞留在服务器的mail.box中,我想修改模板是最好的选择了:打开邮件模板,在共享操作的地方找到发送(S),发送并归档(E),在公式的前面加入: x:=@Integer(@Sum(@Attachments > 0; @AttachmentLengths; 0)/1024); @If(x>5120;@Do(@Prompt([OK];"提示!";"附件超过5120K将不能发送!附件大小共: "+ @Text(x)+ "K";@Return("");"" 再修改便笺表单,选择表单属性,去掉关闭时后面的小叉就可以了.
--------------------------------------------------------------------------------------------------------- 1.打开邮件模板,在共享操作的地方找到发送(S),发送并归档(E),在公式的前面加入:
x:=@Integer(@Sum(@Attachments > 0; @AttachmentLengths; 0)/1024);
@If(x>5120;@Do(@Prompt([OK];"提示!";"附件超过5120K将不能发送!附件大小共: "+ @Text(x)+ "K";@Return("");"" 再修改便笺表单,选择表单属性,去掉关闭时后面的小叉就可以了.
2.现在以NOTES 6.51为例(我不知道以前久版本是不是一样)
邮件模板的名字是:mail6.ntf(在NOTES目录中)
打开方式可以直接在工作台打开-> 指定服务器(不要去找数据库),在下面文件里直接输入mail6.ntf
(R5应该不是mail6.ntf,可能是mail5.ntf吧),就可以打开,用Designer 对其修改
然后象你说的找到相应的表单(便笺很容易找的)Memo,找到操作,修改就可以!!!
更改模版后,需要重新替换原有模版,设置才能生效!
另外:关于在Designer5.0中更改公式无法成功的问题,我查询了IBM官方网站,确实是版本的问题,在5.x系列中都存在此问题
具体参考 https://www.360docs.net/doc/019492592.html,/support/docview.wss?uid=swg21101466
---------------------------------------------------------------------------
关于根据系统语言,显示不同语言的提示,方法有两种
请不要使用Designer5.0更改
原因参考 https://www.360docs.net/doc/019492592.html,/support/docview.wss?uid=swg21101466
1、修改公式
Language:=@RegQueryValue("HKEY_LOCAL_MACHINE";"SYSTEM\\CurrentControlSet\\Control\ \Nls\\Language";"Default");
Size:=@Integer(@Sum(@Attachments > 0; @AttachmentLengths; 0)/1024000);
@If(Size > 10 ; @If(Language = "0804";@Do(@Prompt([Ok];"注意:附件大小超过10M限制!";"
当前附件大小为"+ @Text(Size)+ "M,此邮件将不能发送!"+@Char(13)+"如有任何问题,请联系情报信息部(TEL:351)");@Return(""));@Do(@Prompt([Ok];"Tips:Attachments Over 10M Bytes!";"The Current Attachments is "+ @Text(Size)+ "M bytes,this mail cannot send!"+@Char(13)+"If you have any questions,please contact misgroup(TEL:351)");@Return("")));"");
2、使用Lotus Script
(LS用法类似于VB,但是对于一般用户来说,由于Domino类的结构不清晰,使用起来很麻烦)
此方法代码相对较长,不推荐使用,我也没学过LS开发,可能有错误之处,仅供学习使用
以下只包含核心代码
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim curDB As NotesDatabase
Dim dbDir As NotesDbDirectory
Dim serverName As String
Set db = s.CurrentDatabase
If db.Server = "" Then
serverName = "(local)"
Else
serverName = db.Server
End If
If serverName = "(local)" Then
Set dbDir = New NotesDbDirectory("")
Else
Set dbDir = New NotesDbDirectory(serverName) End If
Set curDB = dbdir.GetFirstDatabase(TEMPLATE_CANDIDATE)
Do Until curDB Is Nothing
Call countThis(curDB, db)
Set curDB = dbDir.GetNextDatabase
Loop
End Sub
Sub countThis(curDB As NotesDatabase, reportDB As NotesDatabase) Dim curSize As DBSizeInfo
On Error Resume Next
Set curSize = New DBSizeInfo(curDB)
Call curSize.count
If curSize.AttachmentCount > 0 Then
Call curSize.save(reportDB)
End If
End Sub
Public Class DBSizeInfo
Private db As NotesDatabase 'The database to be counted Public DBSize As Variant 'Size of the database
Public AttachmentSize As Variant
Public AttachmentCount As Variant
Public DocumentCount As Variant
Public hasError As Boolean
Sub new (curDB As NotesDatabase)
Set db = curDB
hasError = False
End Sub
Public Function Count As Boolean
Dim doc As NotesDocument
Dim dc As NotesDocumentCollection
Dim countResult As Variant
Dim sizeResult As Variant
On Error Goto Err_Count
If Not db.IsOpen Then
Call db.Open("","")
If Not db.IsOpen Then
'We could not open it
Print "Can't open " & db.FilePath
Count = False
Goto Exit_Count
End If
End If
DBSize = db.Size
AttachmentCount = 0
AttachmentSize = 0
DocumentCount = 0
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
Do Until doc Is Nothing
If doc.HasEmbedded Then
Call getAttachmentSizes(doc)
End If
DocumentCount = DocumentCount + 1
Set doc = dc.GetNextDocument(doc)
Loop
Count = True 'If we got here it worked
Exit_Count:
Exit Function
Err_Count:
Print Error$ & " in Count in " & db.FilePath & " in line " & Cstr(Erl)
Count = False
hasError = True
Resume Exit_Count
End Function
Public Sub Save(reportDB As NotesDatabase)
Dim doc As NotesDocument
Dim v As NotesView
Dim searchkey(0 To 1) As String
On Error Goto Err_Save
Set v = reportDB.GetView("(LookupByServerAndPath)")
If v Is Nothing Then
Set doc = New NotesDocument(reportDB)
Else
If db.Server = "" Then
searchkey(0) = "(local)"
Else
searchkey(0) = db.Server
End If
searchkey(1) = Lcase(db.FilePath)
Set doc = v.GetDocumentByKey(searchkey,True)
If doc Is Nothing Then
Set doc = New NotesDocument(reportDB)
End If
End If
Call doc.ReplaceItemValue("Form","SizeReport")
Call doc.ReplaceItemValue("DBSize",Me.DBSize)
Call doc.ReplaceItemValue("AttachmentSize",Me.AttachmentSize)
Call doc.ReplaceItemValue("AttachmentCount",Me.AttachmentCount)
Call doc.ReplaceItemValue("DocumentCount",Me.DocumentCount)
If hasError Then
Call doc.ReplaceItemValue("ErrorFlag",1)
Elseif doc.HasItem("hasError") Then
Call doc.RemoveItem("ErrorFlag")
End If
If db.Server = "" Then
Call doc.ReplaceItemValue("ServerName","(local)")
Else
Call doc.ReplaceItemValue("ServerName",db.Server)
End If
Call doc.ReplaceItemValue("FilePath",Lcase(db.FilePath))
Call doc.Save(True,True)
Exit_Save:
Exit Sub
Err_Save:
Print Error$ & " in " & db.FilePath
Resume Exit_Save
End Sub
Private Sub getAttachmentSizes(doc As NotesDocument)
Dim attNames As Variant
Dim att As NotesEmbeddedObject
Dim result As Variant
result = 0
On Error Goto Err_getAttachmentSizes
attNames = Evaluate(|@Attachmentnames|, doc)
If attNames(0) <> "" Then
Forall an In attNames
Print "Checking Attachment " & an
Set att = doc.GetAttachment(an)
result = result + att.FileSize
Me.AttachmentCount = Me.AttachmentCount + 1
End Forall
End If
Exit_getAttachmentSizes:
Me.AttachmentSize = Me.AttachmentSize + result
Exit Sub
Err_getAttachmentSizes:
Print Error$ & " in getAttachmentSizes doc: " & doc.UniversalID
Resume Exit_getAttachmentSizes
End Sub
End Class
Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Function GetOsType() As String
Dim ret As String
Select Case Hex(GetSystemDefaultLCID)
Case 804:
ret = "input chinese tips"
Case Else:
ret = "input english tips"
End Select
GetOsType = ret
End Sub
想修改模板是最好的选择了:打开邮件模板,在共享操作的地方找到发送(S),发送并归档(E),在公式的前面加入: x:=@Integer(@Sum(@Attachments > 0; @AttachmentLengths; 0)/1024); @If(x>5120;@Do(@Prompt([OK];"提示!";"附件超过5120K将不能发送!附件大小共: "+ @Text(x)+ "K";@Return("");"" 再修改便笺表单,选择表单属性,去掉关闭时后面的小叉就可以了.