Board index » delphi » TidAntifreeze

TidAntifreeze

Hi,

I put the compoent TidAntifreeze on my form and I create a sendmail program.

The program up to when has not finished, it is blocked.

Why ?  idAntiFreeze ?

thanks antonello

I use this code:

  with IdSMTP1 do
  begin

    Caption := 'Trying to sendmail via: ' + shost;
    Msg('Trying to sendmail via: ' + sHost);

    try
      host := sHost;
      Msg('Attempting connect');
      Connect;
      Msg('Successful connect ... sending message');

      SendCmd('Mail from:<' + idmessage1.From.Address + '>', 250);

      if SendCmd('RCPT to:<' + rcpt + '>', [250, 251]) = 250 then
        Msg('ok');

      SendCmd('Data', 354);

      idsmtp1.WriteFile('c:\windows\desktop\prova.send');

      SendCmd('.', 250);
      Msg('Attempting disconnect');
      Disconnect;
      msg('Successful disconnect');
      result := true;
      deletefile('c:\windows\desktop\prova.send');

    except on E: Exception do
      begin
        if connected then try disconnect; except end;
        Msg('Error sending message');
        result := false;

        ShowMessage(E.Message);
      end;
    end;
  end;
  Caption := '';

end;

 

Re:TidAntifreeze


Your program is blocked, but can receive Windows-Messages.
------------------------------------------------
Thomas Wegner

"Antonello Carlomagno" <a.carloma...@starsoft.net> schrieb im Newsbeitrag
news:3b445ce1_1@dnews...
Hi,

I put the compoent TidAntifreeze on my form and I create a sendmail program.

The program up to when has not finished, it is blocked.

Why ?  idAntiFreeze ?

thanks antonello

I use this code:

  with IdSMTP1 do
  begin

    Caption := 'Trying to sendmail via: ' + shost;
    Msg('Trying to sendmail via: ' + sHost);

    try
      host := sHost;
      Msg('Attempting connect');
      Connect;
      Msg('Successful connect ... sending message');

      SendCmd('Mail from:<' + idmessage1.From.Address + '>', 250);

      if SendCmd('RCPT to:<' + rcpt + '>', [250, 251]) = 250 then
        Msg('ok');

      SendCmd('Data', 354);

      idsmtp1.WriteFile('c:\windows\desktop\prova.send');

      SendCmd('.', 250);
      Msg('Attempting disconnect');
      Disconnect;
      msg('Successful disconnect');
      result := true;
      deletefile('c:\windows\desktop\prova.send');

    except on E: Exception do
      begin
        if connected then try disconnect; except end;
        Msg('Error sending message');
        result := false;

        ShowMessage(E.Message);
      end;
    end;
  end;
  Caption := '';

end;

Re:TidAntifreeze


U know its easier than this ...

eg:

with idSMTP do
    begin
    Connect;
    if connected then Send(AMessage); // where AMessage is a TidMessage
already formatted for you
    Disconnect;
    end;

/A.

Quote
"Antonello Carlomagno" <a.carloma...@starsoft.net> wrote in message

news:3b445ce1_1@dnews...
Quote
> Hi,

> I put the compoent TidAntifreeze on my form and I create a sendmail
program.

> The program up to when has not finished, it is blocked.

> Why ?  idAntiFreeze ?

> thanks antonello

> I use this code:

>   with IdSMTP1 do
>   begin

>     Caption := 'Trying to sendmail via: ' + shost;
>     Msg('Trying to sendmail via: ' + sHost);

>     try
>       host := sHost;
>       Msg('Attempting connect');
>       Connect;
>       Msg('Successful connect ... sending message');

>       SendCmd('Mail from:<' + idmessage1.From.Address + '>', 250);

>       if SendCmd('RCPT to:<' + rcpt + '>', [250, 251]) = 250 then
>         Msg('ok');

>       SendCmd('Data', 354);

>       idsmtp1.WriteFile('c:\windows\desktop\prova.send');

>       SendCmd('.', 250);
>       Msg('Attempting disconnect');
>       Disconnect;
>       msg('Successful disconnect');
>       result := true;
>       deletefile('c:\windows\desktop\prova.send');

>     except on E: Exception do
>       begin
>         if connected then try disconnect; except end;
>         Msg('Error sending message');
>         result := false;

>         ShowMessage(E.Message);
>       end;
>     end;
>   end;
>   Caption := '';

> end;

Other Threads