Methods
| Add | Add an email. |
| Remove | Remove specified email. |
| Clear | Remove all emails in current collection. |
| Sort | Sort emails in current collection. |
Properties
| Count | Emails count in current collection. |
| Unread | Total count of unread emails in current collection. |
| Items | Get Mail object of specified email. |
Remarks
MailCollection object is a collection made up of Mail objects. It can be used to manage mails in specified mailbox.
Usage Example
Dim server, user, password, requestAddr
server = "localhost"
user = "hunter@emailarchitect.net"
password = "mypassword"
requestAddr = "192.168.0.1"
Dim oSvr
Set oSvr = CreateObject("EmailArchitectObjects.ServerRoot")
r = oSvr.Connect( server, user, password, 0, requestAddr )
If r <> 0 Then
WScript.Echo( "connect server failed!" )
WScript.Quit
End If
Dim oDomains, oDomain
Set oDomains = oSvr.DomainCollection
Set oDomain = oDomains.Items(CStr(oSvr.Domain))
Dim oUsers, oUser
Set oUsers = oDomain.UserCollection
Set oUser = oUsers.Items(CStr(oSvr.User))
Dim oMBXs, oMBX, oTools
Set oTools = CreateObject("EmailArchitectObjects.Tools")
Set oMBXs = oUser.MBXCollection
Set oMBX = oMBXs.Items(CStr(oTools.EncodeHex("inbox")))
Dim oMails, oMail
Set oMails = oMBX.MailCollection
'enumerate all mails in "Inbox"
Dim i, nCount
nCount = oMails.Count
For i = 0 To nCount-1
Set oMail = oMails.Items(CLng(i))
WScript.Echo( oMail.Subject )
Next