Manage Learn to apply best practices and optimize your operations.

Finding Attachments In Mail Messages

I was writing a file attachment report program, one which basically stripped
some attachments from user's mailfiles and reported on the presence of all
others. In doing so, I ran across several possible "gotchas" where the code
would fail. This segment is the result of all of that bug testing - it runs on
80,000+ mailfiles without having a problem, so it probably finds all of the
attachments in a mail doc.... add it to your code once you have the doc open
already - which I left out of this small sample piece.
' The Body Field should be the only place that attachments are stored.
' But, it turns out that there is also a possibility of SEVERAL rich text
fields, and SEVERAL $FILE fields.
If Not( Isempty( doc.EmbeddedObjects ) ) Then
' EmbeddedObjects is NOT empty.
Forall O In MF_doc.EmbeddedObjects
' FIRST (of two) place to do what you want to the attachments....
End If
End Forall
End If
' Find all rich text fields
Forall itemfields In doc.items
If item.Type <> RICHTEXT Then
' This Body is not a Rich Text Item.
' No Attachments possible
Elseif Isempty( item.EmbeddedObjects )Then
' Rich text, but no attachments.
' There was a Rich Text field, and it has embedded objects. Are
they attachments?
Forall O In item.EmbeddedObjects
' Do what you want to to the embedded objects here...
End If
End Forall ' All attachments in RTF
End If ' not RTF
End Forall
This was last published in November 2000

Dig Deeper on Domino Resources - Part 6

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...