E-mails with one or more attachments delivered to addresses reaching their size limit threshold usually generate non-delivery reports (NDRs), and the attachment is then sent back to sender. In our Notes environment, this often creates "dead mails," because these mails canot be delivered back to sender and remain in the "mail.box" router database. Even these messages can cause the sender to exceed their mail quota threshold (particularly during mass mailings). They also consume the server's disk space and can impact mail routing between servers.
There is no way to set up an option such as "do not attach the attachment to NDR" in Domino. (Nor can you do this in Exchange, without modifying parameters in the OS register.)
To create a procedure for doing this and eliminating this "unwanted feature," I developed an application called NDR queue -- "NDRqueue.nsf" on our hub mail server. The application was created from the standard mail router mailbox template and is stored in the root of this server. I also created rules on this server (tab "Rules" in "Servers-Configurations-Configuration" document). This rule was defined thusly: "When message contains "NonDelivery Report" form and it contains more than 0 attachment then move this message to "NDRqueue.nsf" database."
I also created a triggered agent named "Manage NDR" which is launched automatically after creating or modifying a document in these databases. By our server settings, the agent runs every 30 minutes, but it could be less. This agent searches for unprocessed documents and deletes all embedded objects from them and moves them back to the mail router. The final NDR message sent to mail sender (during my tests) was only 1.7 KB instead of the original message's 3.7 MB.
This scenario could be used also for several hub servers in cluster. Each server needs to have this one application (NDR Queue). This application could be created as replicas of each other too. I am able to provide a template of this application.
The ACL was set up to manager access for all members of "Notes Admin" group and to manager access to local server. Default access is depositor.
Any comments or suggested improvements are appreciated.
Sub Initialize
Dim session As New notessession
Dim db As notesdatabase
Dim spam As notesDocumentCollection
Dim spamDoc As notesdocument
Dim rtitem As Variant
Dim object As NotesEmbeddedObject
Dim richStyle As NotesRichTextStyle
Set richStyle = session.CreateRichTextStyle
Set db=session.currentDatabase
Dim mailboxDb As New NotesDatabase
( db.Server, "mail.box" ) ' if you have more than
one mail.box it is better to use 'mail1.box'
Set spam=db.UnprocessedDocuments
Set spamDoc=spam.getFirstDocument
While Not spamDoc Is Nothing
Set rtitem =
spamDoc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
If Not Isempty
(rtitem.EmbeddedObjects) Then
Forall o In rtitem.EmbeddedObjects
If (( o.Type = EMBED_ATTACHMENT )
Or ( o.Type = EMBED_OBJECTLINK )
Or ( o.Type = EMBED_OBJECT )) Then
Call rtitem.AddNewLine( 2 )
richStyle.NotesColor = COLOR_RED
richStyle.FontSize = 10
richStyle.Bold = True
Call rtitem.AppendStyle(richStyle)
Call rtitem.AppendText( "Attached file
(object) '" & o.Source & "' has been deleted...")
Call o.Remove
End If
End Forall
End If
If spamDoc.HasEmbedded Then
Forall i In spamDoc.Items
If i.Type = ATTACHMENT Then
Set Object = spamDoc.GetAttachment( i.Values(0) )
Call Object.Remove
End If
End Forall
End If
spamDoc.FailureReason =
spamDoc.FailureReason(0) &
"!" 'Mark processed record
spamDoc.Processed = "1"
Call spamDoc.Save( True, True )
Call spamDoc.CopyToDatabase( mailboxDb )
' copy only if there is NDR with attachments
End If
Call session.UpdateProcessedDoc( spamDoc )
Set spamDoc=spam.getNextDocument(spamDoc)
Wend
Set spam=db.unprocessedSearch
({@Contains(Processed;"1")},Nothing,0)
If spam.Count > 0 Then
Call spam.removeAll(True)
End If
End Sub
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Pavol Polacek. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our bimonthly tip contest and you could win a prize and a spot in our Hall of Fame.