你应该用MAPISession和Mapimessages这两个控件,在部件中加入
代码如下:
    mapiSesson1.SignOn
    With Mapimessages1
        .MsgIndex = -1
        .RecipDisplayName = "[email protected]"
        .MsgSubject = "Title"
        .AttachmentIndex = 0
        .AttachmentPathName = "c:\test.txt"
        .SessionID = mapiSesson1.SessionID
        .Send
    End With
    mapiSesson1.SignOff
    MsgBox "邮件发送完毕!", , "发送邮件"

解决方案 »

  1.   


    您可以通过Outlook Object Library中的MailItem对象的属性和方法添加附件,并生成新邮件,指定收件人、主题等信息,并发送,如下例:Private Sub Command1_Click()
        NewMailWithAttachment
    End Sub Sub NewMailWithAttachment()
             ' The Outlook object library needs to be referenced
             Dim ol As Outlook.Application
             Dim NewMessage As Outlook.MailItem
             Dim myRecipient As Outlook.Recipient
             
             Set ol = New Outlook.Application
             ' Create a new MailItem
             Set NewMessage = ol.CreateItem(olMailItem)
             ' Embed a file into the new message
             NewMessage.Attachments.Add "e:\fred.xls", olByValue
             ' Display the message
             NewMessage.Subject = "testmessage"
             Set myRecipient = NewMessage.Recipients.Add("Laura Jennings")
             myRecipient.Type = olCC
             NewMessage.Display
             NewMessage.Send
             
    End Sub