Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: Programaticlly adding to recipients list
| Subject: | Re: Programaticlly adding to recipients list |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Fri, 9 Jun 2006 11:40:37 |
"Mac Davis" <newsgroups@blindsided.org> wrote in message
news:4489bdb8$1@newsgroups.borland.com...
> Could someone please provide an example of programatically
> creating a list of recipients?
TIdMessage has a Recipients property that is a TCollection descendant.
Simply Add() new items to it.
> For example, let's suppose I have a TMemo with one email address per line.
>
> How would I add those addresses to a TIdMessage ?
To set the entire list using a single string, you can use the EMailAddresses
property, ie:
IdMessage.Recpients.EMailAddresses := Memo1.Lines.CommaText;
Otherwise, you have to call Add() in a loop, ie:
IdMessage.Recipients.Clear;
for i := 0 to Pred(Memo1.Lines.Count) do
IdMessage.Recipients.Add.Address := Memo1.Lines[i];
For future reference, please read the Indy documentation.
Gambit
none