NetTalk Central

Author Topic: Sending Bulk emails.....  (Read 4585 times)

Richard I

  • Sr. Member
  • ****
  • Posts: 398
    • View Profile
    • Email
Sending Bulk emails.....
« on: November 19, 2016, 12:08:31 AM »
Hi There,
Using the "TestEmailsendControl template"
Im wanting  to send bulk emails.

The problem is that  the looping of the code seems to overwrite the lsendto variable  so that all the emails go to one email address.
The email address changes  with the messages.as expected.

Is there a work around, or a different template perhaps?

Thanks
 Richard


This is the code im using to call the template and process....
lCount = 0
Display()


SET(Dinner)
LOOP until access:Dinner.Next()
   IF Din:EmailConfirmation = 1       THEN CYCLE END
   IF Din:RequestDate <  lstartdate  THEN CYCLE END
   IF Din:RequestDate > lenddate    THEN CYCLE END
   lsendto = Din:Email
   MESSAGE('Din:Email = '& Din:Email)

   POST(EVENT:Accepted,?BUTTONSendEmail)
 
   MESSAGE('Din:Email = '& Din:Email)
 
   lCount += 1
   Display()
   Din:EmailConfirmation = 1
   access:Dinner.Update()   
END

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Sending Bulk emails.....
« Reply #1 on: November 22, 2016, 06:52:48 AM »
Hi Richard,

Do not create a loop inside the procedure.
Create a loop outside the procedure, which calls the procedure once per email address.
See the \examples\nettalk\email\demo example. (nt9)
or \email\send emails from a process example (nt8)

cheers
Bruce