Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : Re: Problems adding more than one recipient to a TIdMessage
| Subject: | Re: Problems adding more than one recipient to a TIdMessage |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Wed, 12 Dec 2007 23:23:06 |
"Paul Coshott" <paul@pacsoftware.com.au> wrote in message
news:4760d83d@newsgroups.borland.com...
> Firstly, is there an easier way to add a comma or semi
> colon separated list of emails to the Recipients property
> of the TIdMessage component?
Yes. Use the EmailAddresses property of the Recipients list, rather than
calling its Add() method directly, ie:
IdMessage1.Recipients.EmailAddresses := tblCustEMail.AsString;
> the problem I am having is the last email address added
> is the only one in the Recipients list.
That is because you are calling Recipients.Add() only once, replacing its
Name and Address property values with each iteration of your loop. You need
to call Add() for each email address individually.
> It seems the Add method is not adding a new one each time
Yes, it does. But you are only calling it once to begin with.
Gambit