Results 1 to 7 of 7

Thread: [RESOLVED] Sending email to Multiple addresses

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2010
    Posts
    71

    Resolved [RESOLVED] Sending email to Multiple addresses

    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:
    1. 'Logon & Sync
    2.     MAPISession.SignOn
    3.  
    4.     ' Create Message w/Attachments then Send
    5.     With MAPIMessages
    6.          .SessionID = MAPISession.SessionID
    7.          .Compose
    8.          .MsgSubject = txtSubject
    9.          
    10.          'A value (Spaces)is passed to the Space() function in the
    11.          'next line based on the number of attachments to add.
    12.          'These spaces act as placeholders for the attachments.
    13.          If Trim(txtLocation(0)) <> "" Then Spaces = Spaces + 1
    14.          If Trim(txtLocation(1)) <> "" Then Spaces = Spaces + 1
    15.          
    16.          If Spaces <> 0 Then  ' there are no attachments to send
    17.               .MsgNoteText = Space(Spaces) & vbCrLf '& rtbMessage
    18.              
    19.              'Replace the AttachmentPathName values below as applicable.
    20.              .AttachmentIndex = 0
    21.              .AttachmentPosition = 0
    22.              .AttachmentPathName = Trim(txtLocation(0).Text)  '   ("c:\Send email 1.txt")
    23.              
    24.              .AttachmentIndex = 1
    25.              .AttachmentPosition = 1
    26.              .AttachmentPathName = Trim(txtLocation(1).Text)  '("c:\send email 2.txt")
    27.         End If
    28.  
    29.         ' add the message to the email
    30.         .MsgNoteText = .MsgNoteText & txtMessage
    31.          
    32.         .RecipType = 1
    33.         For N = 0 To ubound(gsortrec)
    34.             .RecipAddress = Trim(gSortRec(N).Email)
    35.             .recipindex = 1
    36.         Next N
    37.        
    38.         .Send False
    39.  
    40.    MAPISession.SignOff
    Last edited by Hack; Nov 23rd, 2011 at 02:34 PM. Reason: Added Highlight tags for posted code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width