1 Replies - 233 Views - Last Post: 27 January 2012 - 01:14 AM Rate Topic: -----

Topic Sponsor:

#1 cuatanic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-January 12

sending multiple email

Posted 26 January 2012 - 07:25 PM

i am making a program that sends email to multiple recipients. the recipients are coming from a database. my problem is it only sends to the 1st and 3rd recipient. it ignores the 2nd and the fourth recipient.

here what i have so far

search.Text = ""

    Dim StartPos, Counter As Integer
    Dim FindString, ReplaceText As String
    FindString = "       "
    ReplaceText = " ; "
     
    For Counter = 1 To Len(address.Text)
            StartPos = InStr(address.Text, FindString)
            If StartPos > 0 Then
                    address.SelStart = StartPos - 1
                    address.SelLength = Len(FindString)
                    address.SelText = "" + ReplaceText
            End If
    Next

Dim s
        Dim se() As String
        Dim InputContainer As String
        InputContainer = address.Text
        se() = Split(InputContainer, " ; ")

'Dim add As String
'add = address.Text

'Dim addr() As String
'addr = Split(add)

Dim ctr As Integer
Dim addcount As Integer

For ctr = 0 To 3

MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
'Compose new message
MAPIMessages1.Compose
'Address message
'addcount = rstAddress.RecordCount

MAPIMessages1.RecipAddress = se(ctr)
ctr = ctr + 1
' Resolve recipient name
MAPIMessages1.AddressResolveUI = True
MAPIMessages1.ResolveName

'Create the message
MAPIMessages1.MsgSubject = subj.Text
MAPIMessages1.MsgNoteText = body.Text
'Send the message
MAPIMessages1.send False
MAPISession1.SignOff

Next




thank you

Is This A Good Question/Topic? 0
  • +

Replies To: sending multiple email

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 211
  • View blog
  • Posts: 1,249
  • Joined: 26-March 09

Re: sending multiple email

Posted 27 January 2012 - 01:14 AM

Try removing the ctr = ctr + 1 at line 42.

You're already incrementing the ctr variable in the loop, so you're incrementing it twice, hence it jumping in 2's
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1