Home > Domino Tips > Administrator > Mail > Size and List of All File Attachments in a Mailbox
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

MAIL

Size and List of All File Attachments in a Mailbox


Larry Wagner
03.19.2001
Rating: -3.33- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


A LotusScript agent for users or administrators to run that gives the person running the agent a pop-up with the total number of attachments and approximate percent of their mailbox. It also mails the person a list of all attachments with name, size and date, sender and a doclink to the e-mail. It ignores attachments under 50,000 bytes, but this amount is programable.

In estimating the percentage of mailbox space dedicated to the attachments, I have not been able to determine compression, so I max'ed the percentage displayed at 94 % of mailbox space. I chose 94% because 94 does not sound rounded off.

The agent did crash on one mailbox, for unknown reasons, after debugging was complete. But I have personally run it in many dozen mailboxes to assist users in evaluating unnecessary attachments they were keeping.



Code

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dateTime As NotesDateTime
Dim item As notesItem
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument, maildoc As notesDocument
Dim j As Integer, AttachList As String, n As String, size As Double
Dim d As String, Tbytes As Double, JunkSize As Double
Dim messageLine As String
Dim a As Integer, aCount As Integer, vListType As Integer
a = 0
Tbytes = Cdbl(0)
Set db = session.CurrentDatabase
Dim dbSize As Double, Mb As Double
dbSize = Cdbl(db.Size)
Dim DBpercent As Integer, Tsize As Integer, Dsize As Integer
Dim FiftyKBtyes As Double
FiftyKbytes = Cdbl (49999)
Mb = Cdbl( 1048000 )
Dsize = Cdbl(dbSize / Mb)
Set maildoc = New NotesDocument( db )
maildoc.Form = "Memo"
REM set the new document's form so it'll be readable as a mail memo
maildoc.Subject = "E-Mail File Attachments of " + _
db.Title ' set the new document's Subject to the Tag File Name
Dim RTitemA As NotesRichTextItem, RTitem As NotesRichTextItem
Set RTitemA = New NotesRichTextItem( maildoc, "Body" )
Call rtitemA.AppendText ( "E-Mail File Attachments of " + db.Title)
Call RTItemA.AddNewLine( 2)
Call rtitemA.AppendText ( " Mailbox size is expected to be under 50 Mb. " )
Call RTItemA.AddNewLine( 2)
Call rtitemA.AppendText ( "You have a mailbox of " + Cstr(dSize) + " Mb " )
Call RTItemA.AddNewLine( 1)
Dim subjectLine As String
Set collection = db.AllDocuments
Set doc = collection.GetFirstDocument
While Not (doc Is Nothing)
If Not (doc.hasitem("Body") ) Then
Goto Next_One
End If
subjectLine = doc.Subject(0)
If doc.HasEmbedded Then
Set rtitem = doc.GetFirstItem( "Body" )
If doc.hasitem("PostedDate") Then
Set item = doc.GetFirstItem("PostedDate")
D = item.DateTimeValue.DateOnly
Elseif doc.hasitem("DeliveredDate") Then
Set item = doc.GetFirstItem("DeliveredDate")
D = item.DateTimeValue.DateOnly
Else
d = ""
End If
If rtitem.Type = RICHTEXT Then
vList = rtItem.EmbeddedObjects
vListType = Datatype ( vList )
Print Cstr(vListType) + " Data type of vList, subject = " +
SubjectLine
If vListType <> 0 Then
aCount = 0
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
n = o.name
If n Like ( "att#.eml" ) Then
size = Cdbl(o.filesize)
JunkSize = JunkSize + size
Call o.Remove
Call doc.Save( False, True )
size = Cdbl(0)
Else
size = Cdbl(o.filesize)
End If
If size > FiftyKBytes Then
If aCount = 0 Then
Call RTItemA.AddNewLine( 1)
Call RTitemA.AppendDocLink ( doc,
doc.from( 0 ) & " in " & "All Documents" )
Call RTitemA.AppendText ("Subject
line: " +doc.Subject(0) )
Call RTItemA.AddNewLine( 1)
Call RTitemA.AppendText (" From " +
doc.From(0) )
Call RTItemA.AddNewLine( 1)
End If
Call RTitemA.AppendText(" " + Cstr(size)
+ " Bytes received on " + d + _
" FileName: " + N )
Call RTItemA.AddNewLine( 1)
aCount = aCount + 1
a = a + 1
Tbytes = Tbytes + size
End If
End If
End Forall
End If
End If
End If
Next_One:
Set doc = collection.GetNextDocument (doc)
Wend
Send_End:
Dim dtemp As Double
If Cdbl(Tbytes) > Cdbl(0) Then
dtemp = Cdbl(Tbytes / Mb)
Tsize = Cint(dtemp)
Else
Tsize = 0
End If
dTemp = (TBytes * 100) / dbSize
dbPercent = Cint(dTemp)
If dbPercent > 99 Then
dbPercent = 94
End If
messageline = "You have at least " + Cstr(a) + " e-mail attachments" + _
Chr(10) + "Those of 50,000 Bytes, uncompressed, are over " + Cstr(Tsize) +
_
" Mb ." + Chr(10) + Chr(10) + _
"This is possibly " + Cstr(DBPercent) + " % of your " + Cstr(dSize) + " Mb
mailbox. "
Msgbox messageLine + Chr(10) + Chr(10) + _
"Please delete any duplicates. An e-mail lists the names." + Chr (10) + _
Chr(10) + "Junk Internet files deleted occupying " + _
Cstr( JunkSize) + " bytes." , 64, "Check File Attachments"
Call RTItemA.AddNewLine( 2)
Call rtitemA.AppendText ( " Mailbox size is expected to be under 50 Mb. " )
Call RTItemA.AddNewLine( 2)
Call rtitemA.AppendText ( "You have at least " + Cstr(a) + _
" e-mail attachments." )
Call RTItemA.AddNewLine( 1)
Call rtitemA.AppendText _
( "Those of 50,000 Bytes or more total over " + Cstr(Tsize) + " Mb " )
Call RTItemA.AddNewLine( 1)
Call rtitemA.AppendText _
( "This is " + Cstr(DBPercent) + " % of your " +Cstr(dSize) + " Mb mailbox.
" )
maildoc.SendTo = session.CommonUserName
Call maildoc.Send( False ) ' send the new document to the recipient
End Sub


Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Mail
Run or restart Notes/Domino agents via text messages
How to create mail files using a LotusScript agent
How to turn off the message recall feature in Lotus Notes 8
Domino server setting and email policy tricks admins must know
Top 10 Lotus Notes/Domino administration tips of 2008
Understanding a Lotus Notes Smart Upgrade rollout
Bringing MailRule documents back into view
Use SMTP outbound authentication to relay hosts in Lotus Notes Domino 8
Notes/Domino 6 version of 'Discover Folder'
Five tips to improve email performance

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts