Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jun : Send same message to Multiple Recip[ients (indy 10)

www.cryer.info
Managed Newsgroup Archive

Send same message to Multiple Recip[ients (indy 10)

Subject:Send same message to Multiple Recip[ients (indy 10)
Posted by:"E.P." (pergol..@aca.cableonline.com.mx)
Date:Thu, 28 Jun 2007 00:01:40

Hi
I know how to send a message to 1 recipient.
I like to do a mail-merge.
I have a component SMTP (TIdSMTP), a MsgSend (TIdMsgSend) and  these
procedures:
SMTPsetup;   // set SMTP Host, port,  (my) username
Load_message  //  From Address, 1 Recipient, Body etc. loaded in the MsgSend
e component the 'body is recreated for
                             each  recipient with a few different data
The recipient asddress would be loaded from a separate file, 1 at the time
(I do not want to send them all at once, so that they do not see the names
of the other recipients);

So I have this routine:

      SMTPsetup;
      SMTP.Connect;
      Application.ProcessMessages;  //   is this line WRONG?
      try
          repeat
            get_1_recipiet_address
            Load_message_Into_MsgSend(this_recipient_data)
            SMTP.Send(MsgSend);
          until no_more_recipient;
      finally
        SMTP.Disconnect;
      end;
My questions are:
a) this seems to work, but not all the times: is the Connect-Disconnect call
ok as it is, or should I
     call them for each 'sending' (i.e. inside the repeat loop?)
2. How can I give info to the end-user as to tell them something like
        Connecting.....
        Sending e-mail to recipient1
        successfully completed
        Disconnecting ..... etc.... and obvioiulsy tell them the reason of
an error, if one was encountered?
Thanks very much in advance
Enrico

Replies:

www.cryer.info
Managed Newsgroup Archive