Hi
I have another problem, I hope the last one.
My email have to be send to many people, for example to 150.
I know that some servers have limit for recipients for one email. 
So, I have written procedure that divide this 150 people for 100 and 50.
So, first mail will be send to 100 people and the rest, 50 will be send in 
second email.

This users (recipients) are in TStringList. (Lista)
like this:
..
Lista.Strings[0]);  --> [EMAIL PROTECTED]; [EMAIL PROTECTED];.... [EMAIL 
PROTECTED];   // in first mail n=100
Lista.Strings[1]);  --> [EMAIL PROTECTED]; [EMAIL PROTECTED];.... [EMAIL 
PROTECTED];   // in second mail n=50

I have Button - in OnClick I have procedure : "Send"

This "Send" procedure is:

procedure Send;
var
..
begin
   Lista:=TStringList.Create;
   ...
//code to create Lista with lines of adress (each lines have max 100 adresses)
...
 // now, I Am sending email in the loop - in our case it will be done 2 times


//**************************************************************
          for i:= 0 to Lista.Count-1  do   // from 0 to 1
             begin
                   SendMail(Lista.Strings[i]);
             end;
//**************************************************************   // it is not 
working


       end;
   finally
       Lista.Free;
   end;
end;

and the last is:
procedure SendMail(Adresses : string);
        FRunning := TRUE;
        try
          HtmlSmtpClient.PlainText:= nil;
          HtmlSmtpClient.HtmlText:= EmailBody;
          HtmlSmtpClient.EmailImages.Clear;
          HtmlSmtpClient.EmailImages.Add(ObrazekMaila1);
          HtmlSmtpClient.EmailImages.Add(ObrazekMaila2);
          HtmlSmtpClient.Host:= SmtpServerName;
          HtmlSmtpClient.Port:= IntToStr(SmtpServerPort);
          HtmlSmtpClient.FromName:=UserName + ' <'+UserEmail+'>';
          HtmlSmtpClient.HdrSubject:=TematWiadomosciE.Text;

          case SmtpAuthType of
            0: HtmlSmtpClient.AuthType:= smtpAuthNone;
            1: HtmlSmtpClient.AuthType:= smtpAuthLogin;
          end;

          if SmtpServerPassword<>'' then
            begin
               HtmlSmtpClient.Password:=SmtpServerPassword; //passwordedit.Text;
            end else
            begin
               HtmlSmtpClient.Password:=InputBox('Podaj hasło do serwera 
SMTP','Hasło:','');
            end;

          if SmtpServerUser<>'' then
            begin
               HtmlSmtpClient.Username:=SmtpServerUser;
            end else
            begin
               HtmlSmtpClient.Username:=InputBox('Podaj login do serwera 
SMTP','Login:','');
            end;
          HtmlSmtpClient.RcptName.Clear;
          HtmlSmtpClient.RcptNameAdd('', '', Adresses);

          Display('Łączenie z serwerem SMTP ('+ SmtpServerName +')...');
          HtmlSmtpClient.Connect;
        except
            on E:Exception do
              begin
                 Display(E.ClassName + ': ' + E.Message);
                 FRunning := FALSE;
              end;
        end;



And - what am I doing wrong - this doesn't work. Sending email is like in demo 
program.
I have message:
Łączenie z serwerem SMTP (SmtpServerName)...
Łączenie z serwerem SMTP (SmtpServerName)...   // from SendMail procedure
SmtpException: SMTP component not ready

So, how can I do this correct? How to know, that sending first mail to 100 
people are done, that I can send seconf mail? 
I think, that component is trying to send two emails in the same time... but i 
think that after sending first mail component (TSMTPHtmlClient) should 
disconnect and connect again. I didn't found Disconnect method... 

Please help me
Thanks in advance
Ps: I hope that You understand what I mean... sending one message to many 
people in the same time
Paweł Porwisz
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to