源代码如下:
Private Sub SendEmail(ByVal EmailAddress As String, ByVal Subject As String, ByVal NoteText As String, ByVal FilePath As String)
    If EmailAddress = "" Then Exit Sub
    On Error GoTo ErrMail
    MAPISession1.LogonUI = False
    MAPISession1.DownLoadMail = False
    MAPISession1.SignOn
    MAPIMessages1.SessionID = MAPISession1.SessionID
    MAPIMessages1.Compose
    MAPIMessages1.RecipAddress = EmailAddress
    MAPIMessages1.MsgSubject = Subject
    MAPIMessages1.MsgNoteText = NoteText
    'Add the Attachment at the end of the message
    MAPIMessages1.AttachmentPosition = Len(MAPIMessages1.MsgNoteText)
    'Set the type to a data file
    MAPIMessages1.AttachmentType = mapData
    'Give it a name
    'MAPIMessages1.AttachmentName = txtAttachmentName.Text
    'Specify what file to send
    MAPIMessages1.AttachmentPathName = FilePath
    MAPIMessages1.Send False 'false means do not show the composition window
ErrMail:
    If MAPISession1.SessionID <> 0 Then MAPISession1.SignOff
    If Err.Number <> 0 Then Err.Raise Err.Number, Err.Source, Err.Description
End Sub

解决方案 »

  1.   

    改变地址EmailAddress ,执行两次
      

  2.   

    Private Sub SendEmail(ByVal EmailAddress As String, ByVal Subject As String, ByVal NoteText As String, ByVal FilePath As String)
    dim emailArr() as string    
    If EmailAddress = "" Then Exit Sub
        emailArr = spilt(EmailAddress,"#")
    for i = 0 to ubound(eamilArr)    On Error GoTo ErrMail
        MAPISession1.LogonUI = False
        MAPISession1.DownLoadMail = False
        MAPISession1.SignOn
        MAPIMessages1.SessionID = MAPISession1.SessionID
        MAPIMessages1.Compose
        MAPIMessages1.RecipAddress = eamilArr(i)'*****************
        MAPIMessages1.MsgSubject = Subject
        MAPIMessages1.MsgNoteText = NoteText
        'Add the Attachment at the end of the message
        MAPIMessages1.AttachmentPosition = Len(MAPIMessages1.MsgNoteText)
        'Set the type to a data file
        MAPIMessages1.AttachmentType = mapData
        'Give it a name
        'MAPIMessages1.AttachmentName = txtAttachmentName.Text
        'Specify what file to send
        MAPIMessages1.AttachmentPathName = FilePath
        MAPIMessages1.Send False 'false means do not show the composition window
    ErrMail:
        If MAPISession1.SessionID <> 0 Then MAPISession1.SignOff
        If Err.Number <> 0 Then Err.Raise Err.Number, Err.Source, Err.Description
    End Sub
    调用的时候住地址和抄送地址用#号连接起来
      

  3.   

    zgvslch(烟花离落) :
       好像还是不行阿!
       比如我要发送给 [email protected],同时抄送这封信给 [email protected] !应该怎么改写
      

  4.   

    自己搞定了!!!  不过还是谢谢大家
        MAPISession1.LogonUI = False
        MAPISession1.DownLoadMail = False
        MAPISession1.SignOn
        MAPIMessages1.SessionID = MAPISession1.SessionID
        MAPIMessages1.Compose
        MAPIMessages1.RecipIndex = 0
        MAPIMessages1.RecipAddress = "[email protected]"
        MAPIMessages1.RecipIndex = 1
        MAPIMessages1.RecipAddress = "[email protected]"
        MAPIMessages1.MsgIndex = -1
        MAPIMessages1.RecipType = 2
        MAPIMessages1.MsgSubject = Subject
        MAPIMessages1.MsgNoteText = NoteText
        MAPIMessages1.Send False 'false means do not show the composition window
        If MAPISession1.SessionID <> 0 Then MAPISession1.SignOff