Properties
| Count | Files count in current collection. |
| Items | Get specified Attachment object from current collection. |
Remarks
AttachmentCollection object is a collection made up of Attachment objects. Each Attachment object contains all information of email attachment.
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
'get first mail in "Inbox"
Dim i, nCount
nCount = oMails.Count
If nCount > 0 Then
Set oMail = oMails.Items(CLng(0))
Else
WScript.Quit
End If
'enumerate all attachments.
Dim Attachments, Attachment
Set Attachments = oMail.AttachmentCollection
nCount = Attachments.Count
For i = 0 To nCount-1
Set Attachment = Attachments.Items(i)
WScript.Echo( Attachment.Name )
Next