I had worked on this eariler. This is my first attempt to use the MAPI control. I have searched the web every site I could find relating to sending multiple emails from VB6 and found many references but little real examples. The following is a modification of one that looked promising and it does just what I want to do EXCEPT, it only send an email to the last name in the array. It doesn't make any difference how many array entries there are only the last one gets a email message.
I would appreciate any assistance to determine why this is.
vb Code:
'Logon & Sync MAPISession.SignOn ' Create Message w/Attachments then Send With MAPIMessages .SessionID = MAPISession.SessionID .Compose .MsgSubject = txtSubject 'A value (Spaces)is passed to the Space() function in the 'next line based on the number of attachments to add. 'These spaces act as placeholders for the attachments. If Trim(txtLocation(0)) <> "" Then Spaces = Spaces + 1 If Trim(txtLocation(1)) <> "" Then Spaces = Spaces + 1 If Spaces <> 0 Then ' there are no attachments to send .MsgNoteText = Space(Spaces) & vbCrLf '& rtbMessage 'Replace the AttachmentPathName values below as applicable. .AttachmentIndex = 0 .AttachmentPosition = 0 .AttachmentPathName = Trim(txtLocation(0).Text) ' ("c:\Send email 1.txt") .AttachmentIndex = 1 .AttachmentPosition = 1 .AttachmentPathName = Trim(txtLocation(1).Text) '("c:\send email 2.txt") End If ' add the message to the email .MsgNoteText = .MsgNoteText & txtMessage .RecipType = 1 For N = 0 To ubound(gsortrec) .RecipAddress = Trim(gSortRec(N).Email) .recipindex = 1 Next N .Send False MAPISession.SignOff




Reply With Quote