Domino限制附件大小设置.docx
《Domino限制附件大小设置.docx》由会员分享,可在线阅读,更多相关《Domino限制附件大小设置.docx(13页珍藏版)》请在冰点文库上搜索。
Domino限制附件大小设置
Domino技巧:
如何限制附件大小
大家应该知道,现在的免费(或收费)邮箱,一般都有限制附件大小的功能,当某些附件超过一定容量后,就不能发送,其实DominoServer也有同样的功能,而且设置非常简单。
首先,我们合用DominoAdministrator打开我们的DominoServer,选中在最右边的ConfigurationTab,选中Server-> Configuration,选择编辑当前服务器的ConfigurationDocument.
在ConfigurationDocument中的Router/SMTP->RestrictionandControls->Restriction中有一这可以设置Maximummessagesize,只需要在这里指定允许的最大附件容量即可。
建议不要将附件容量设的太大,不然用户的邮箱可能会很快的增肥.
此方法在DominoR5&R6下试验通过,设置完成后,需要重新启动DominoServer,或直接使用更新命令。
DominoServer可以设置某些附件较大的邮件,在空闲的时候再发送,其实设置就是限制附件的大小。
我们可以在Sendallmessagesaslowpriorityifmessagesizeisbetween:
进行设置。
还没有完成设置呀......
修改用户邮件模板方法来控制附件大小:
相信作为网管的兄弟姐妹们跟我一样,为了限制附件的大小伤透脑筋!
如果在服务器的配置文档中来设置,一是在一台服务器的内部是不生效的,二是多台服务器时,即使生效,会产生大量的大附件邮件滞留在服务器的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.现在以NOTES6.51为例(我不知道以前久版本是不是一样)
邮件模板的名字是:
mail6.ntf(在NOTES目录中)
打开方式可以直接在工作台打开-> 指定服务器(不要去找数据库),在下面文件里直接输入mail6.ntf(R5应该不是mail6.ntf,可能是mail5.ntf吧),就可以打开,用Designer对其修改
然后象你说的找到相应的表单(便笺很容易找的)Memo,找到操作,修改就可以!
!
!
更改模版后,需要重新替换原有模版,设置才能生效!
另外:
关于在Designer5.0中更改公式无法成功的问题,我查询了IBM官方网站,确实是版本的问题,在5.x系列中都存在此问题
具体参考
---------------------------------------------------------------------------
关于根据系统语言,显示不同语言的提示,方法有两种
请不要使用Designer5.0更改
原因参考
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:
AttachmentsOver10MBytes!
";"TheCurrentAttachmentsis"+@Text(Size)+"Mbytes,thismailcannotsend!
"+@Char(13)+"Ifyouhaveanyquestions,pleasecontactmisgroup(TEL:
351)");@Return("")));"");
2、使用LotusScript
(LS用法类似于VB,但是对于一般用户来说,由于Domino类的结构不清晰,使用起来很麻烦)
此方法代码相对较长,不推荐使用,我也没学过LS开发,可能有错误之处,仅供学习使用
以下只包含核心代码
SubInitialize
DimsAsNewNotesSession
DimdbAsNotesDatabase
DimcurDBAsNotesDatabase
DimdbDirAsNotesDbDirectory
DimserverNameAsString
Setdb=s.CurrentDatabase
Ifdb.Server=""Then
serverName="(local)"
Else
serverName=db.Server
EndIf
IfserverName="(local)"Then
SetdbDir=NewNotesDbDirectory("")
Else
SetdbDir=NewNotesDbDirectory(serverName)
EndIf
SetcurDB=dbdir.GetFirstDatabase(TEMPLATE_CANDIDATE)
DoUntilcurDBIsNothing
CallcountThis(curDB,db)
SetcurDB=dbDir.GetNextDatabase
Loop
EndSub
SubcountThis(curDBAsNotesDatabase,reportDBAsNotesDatabase)
DimcurSizeAsDBSizeInfo
OnErrorResumeNext
SetcurSize=NewDBSizeInfo(curDB)
CallcurSize.count
IfcurSize.AttachmentCount>0Then
CallcurSize.save(reportDB)
EndIf
EndSub
PublicClassDBSizeInfo
PrivatedbAsNotesDatabase'Thedatabasetobecounted
PublicDBSizeAsVariant'Sizeofthedatabase
PublicAttachmentSizeAsVariant
PublicAttachmentCountAsVariant
PublicDocumentCountAsVariant
PublichasErrorAsBoolean
Subnew(curDBAsNotesDatabase)
Setdb=curDB
hasError=False
EndSub
PublicFunctionCountAsBoolean
DimdocAsNotesDocument
DimdcAsNotesDocumentCollection
DimcountResultAsVariant
DimsizeResultAsVariant
OnErrorGotoErr_Count
IfNotdb.IsOpenThen
Calldb.Open("","")
IfNotdb.IsOpenThen
'Wecouldnotopenit
Print"Can'topen"&db.FilePath
Count=False
GotoExit_Count
EndIf
EndIf
DBSize=db.Size
AttachmentCount=0
AttachmentSize=0
DocumentCount=0
Setdc=db.AllDocuments
Setdoc=dc.GetFirstDocument
DoUntildocIsNothing
Ifdoc.HasEmbeddedThen
CallgetAttachmentSizes(doc)
EndIf
DocumentCount=DocumentCount+1
Setdoc=dc.GetNextDocument(doc)
Loop
Count=True'Ifwegothereitworked
Exit_Count:
ExitFunction
Err_Count:
PrintError$&"inCountin"&db.FilePath&"inline"&Cstr(Erl)
Count=False
hasError=True
ResumeExit_Count
EndFunction
PublicSubSave(reportDBAsNotesDatabase)
DimdocAsNotesDocument
DimvAsNotesView
Dimsearchkey(0To1)AsString
OnErrorGotoErr_Save
Setv=reportDB.GetView("(LookupByServerAndPath)")
IfvIsNothingThen
Setdoc=NewNotesDocument(reportDB)
Else
Ifdb.Server=""Then
searchkey(0)="(local)"
Else
searchkey(0)=db.Server
EndIf
searchkey
(1)=Lcase(db.FilePath)
Setdoc=v.GetDocumentByKey(searchkey,True)
IfdocIsNothingThen
Setdoc=NewNotesDocument(reportDB)
EndIf
EndIf
Calldoc.ReplaceItemValue("Form","SizeReport")
Calldoc.ReplaceItemValue("DBSize",Me.DBSize)
Calldoc.ReplaceItemValue("AttachmentSize",Me.AttachmentSize)
Calldoc.ReplaceItemValue("AttachmentCount",Me.AttachmentCount)
Calldoc.ReplaceItemValue("DocumentCount",Me.DocumentCount)
IfhasErrorThen
Calldoc.ReplaceItemValue("ErrorFlag",1)
Elseifdoc.HasItem("hasError")Then
Calldoc.RemoveItem("ErrorFlag")
EndIf
Ifdb.Server=""Then
Calldoc.ReplaceItemValue("ServerName","(local)")
Else
Calldoc.ReplaceItemValue("ServerName",db.Server)
EndIf
Calldoc.ReplaceItemValue("FilePath",Lcase(db.FilePath))
Calldoc.Save(True,True)
Exit_Save:
ExitSub
Err_Save:
PrintError$&"in"&db.FilePath
ResumeExit_Save
EndSub
PrivateSubgetAttachmentSizes(docAsNotesDocument)
DimattNamesAsVariant
DimattAsNotesEmbeddedObject
DimresultAsVariant
result=0
OnErrorGotoErr_getAttachmentSizes
attNames=Evaluate(|@Attachmentnames|,doc)
IfattNames(0)<>""Then
ForallanInattNames
Print"CheckingAttachment"&an
Setatt=doc.GetAttachment(an)
result=result+att.FileSize
Me.AttachmentCount=Me.AttachmentCount+1
EndForall
EndIf
Exit_getAttachmentSizes:
Me.AttachmentSize=Me.AttachmentSize+result
ExitSub
Err_getAttachmentSizes:
PrintError$&"ingetAttachmentSizesdoc:
"&doc.UniversalID
ResumeExit_getAttachmentSizes
EndSub
EndClass
DeclareFunctionGetSystemDefaultLCIDLib"kernel32"()AsLong
FunctionGetOsType()AsString
DimretAsString
SelectCaseHex(GetSystemDefaultLCID)
Case804:
ret="inputchinesetips"
CaseElse:
ret="inputenglishtips"
EndSelect
GetOsType=ret
EndSub
想修改模板是最好的选择了:
打开邮件模板,在共享操作的地方找到发送(S),发送并归档(E),在公式的前面加入:
x:
=@Integer(@Sum(@Attachments>0;@AttachmentLengths;0)/1024);@If(x>5120;@Do(@Prompt([OK];"提示!
";"附件超过5120K将不能发送!
附件大小共:
"+@Text(x)+"K";@Return("");""再修改便笺表单,选择表单属性,去掉关闭时后面的小叉就可以了.