Codestone Ltd logo

Search FAQ


Internet Mail Client Control FAQs/Objects/Message Object

How can I read the contents of an email I've received through the POP3Client Object?

ID: S4E19 DATE: N/A

The Body of a received message in held in the .Sections collection of the Message Object.

In most cases you will want to enumerate all the sections in a message and examine the .Type and .SubType properties of each section to determine what action to take for each section (you may also wish to examine the .Disposition property).

Message structures can be hierarchical so while it sometimes sufficient to simply iterate over the top-level sections you will more often want to recurse through the section structure; for example:

' assume we've received a message from a POP3 Server
ProcessSections(MyMsg.Sections)


sub ProcessSections(Sections)

for each section in Sections
  
if (section.type=="multipart"then   
    
' recursively process sub sections of this section...
    
ProcessSections(section.Sections
  
else
    
' do something with a 'normal' section here

    '...

  
end if

next

end sub


Can't find the answer to your question? We're here to help!