以下程式片斷可以儲存郵件的附加檔案: var Inbox: MAPIFolder; MI: MailItem; A: Attachment; i, Count: integer; begin Inbox := NmSpace.GetDefaultFolder(olFolderInbox); for i := 1 to Inbox.Items.Count do begin MI := (Inbox.Items.Item(i) as MailItem); for Count := 1 to MI.Attachments.Count do begin A := MI.Attachments.Item(Count); A.SaveAsFile('C:\My Documents\' + A.DisplayName); end; end; end;