Previous PageNext Page

11.3.2 The Message Interface

The POP3 control's Messages collection provides access to the messages currently in the mail store on the connected server. The properties, methods and collections of the Message object described here are used to access those messages.

There are varying costs associated with accessing different properties of a message. For POP3 servers that support the optional TOP command, accessing any header information and the first few lines of the message may be accomplished without paying the data transfer overhead of moving the entire message from the server to the client. Note: when requesting any of the properties that may be gathered without retrieving the entire message the control will first try the TOP command. If that fails the control will then attempt to fulfill the property request via the full message RETR command.

Properties

(LW = potentially "lightweight" on POP3 servers supporting TOP command).

  • From(LW)
  • Subject(LW)
  • Size(LW)
  • DateSent(LW)
  • DateReceived(LW)
  • MsgId(LW)
  • MsgUID(LW)
  • HasAttachments(LW)
  • Message
Collections
  • To(LW)
  • CC(LW)
  • Headers(LW)
  • Attachments
Methods
  • PreviewMessage
  • SaveAttachments

11.3.2.1 Property Details

From (read)

A string that indicates who sent the mail message.

Subject (read)

A string that indicates what the message may be about. May be null (empty string).

Size(read)

The total size of the current message in bytes.

DateSent(read)

The date and time that them message was sent.

DateRecieved(read)

The date and time that the message was received.

MsgId(read)

The message id of the current message in the collection.

MsgUID(read)

On servers that support the UIDL command, a unique identifier for this message. Unlike the MsgId property, the MsgUID property should not change across POP3 sessions, allowing for more efficient use of previewing and server resources. 0 if the server does not support the UIDL command.

HasAttachments(read)

An "educated guess" based on the message headers (to be lightweight) at whether or not the message has attachments.

Message (read)

The text portion of the message.

11.3.2.2 Collection Details

To

A collection of email addresses that the mail message was sent to. The collection is "read-only", and does not support the standard Append or Delete collection methods.

CC

A collection of email addresses that mail message was sent to as a carbon copy. The collection is "read-only", and does not support the standard Append or Delete collection methods.

Attachments

A collection of attachments of the current mail message, consisting of file name and description. The collection is "read-only", and does not support the standard Append or Delete collection methods.

Headers

A collection of all of the message headers for this message. Includes those headers also accessible via more friendly named fields or other collections (e.g. To, From, DateSent, etc...). May be accessed via the header name or index. The collection is "read-only", and does not support the standard Append or Delete collection methods.

11.3.2.3 Method Details

PreviewMessage

Returns the specified number of lines of the message body. For servers that support the TOP command this is performed without retrieving the entire message body. For messages with attachments or messages that are only binary data (which may be ascertained via the Headers collection) the first N lines of the message may or may not be meaningful to a human reader.

Arguments

Lines

The number of lines desired.

SaveAttachments

Gets the attachment(s) out of the email and then places them in the specific directory on the server.

Arguments

Directory path on the Server

The full path to where to place the attachment(s) to the email as (a) file(s).

11.3.2.4 Note: To, CC and Headers

These are all BSTR collections. Using Count method to obtain the total number of item in the collection and using Item method to obtain each item. The difference is that for To, CC and BCC, the first argument of Item is an 0 based index, while for Headers, the first argument is a string indicates the name of the header item (for example, "From", "To", "Subject", etc).

Example:

Set pop3 = Server.CreateObject("CHILI.POP3.1")

pop3.Connect "mail.foo.com", "myuserid", "mypsswd"

For each item in pop3.Messages

For each CC in Item.CC

MsgBox CC

next

next

pop3.Reset

pop3.Disconnect


Copyright © 2000 Chili!Soft

Previous PageTop Of PageNext Page