function SendSMTP(ESMTP:TSMTP;Von,An,
CC,BCC,Body,ContentType:
String):Boolean;
var
I,J : Integer;
RS,TS : TStringList;
begin
RESULT:=False;
TS:=TStringList.Create;
RS:=TStringList.Create;
try
IdMessage.ContentType:=ContentType;
IdMessage.CCList.Clear;
IdMessage.From.Address:=Von;
TS.CommaText:=
CC;
For I:=0
to TS.Count-1
do
begin
IdMessage.CCList.Add.Address:=TS.Strings[i];
end;
IdMessage.BccList.Clear;
TS.CommaText:=BCC;
For I:=0
to TS.Count-1
do
begin
IdMessage.BccList.Add.Address:=TS.Strings[i];
end;
IdMessage.Recipients.Clear;
RS.CommaText:=An;
For J:=0
to RS.Count-1
do
begin
IdMessage.Recipients.Add.Address:=RS.Strings[J];
end;
IDMessage.Body.Text:=Body;
//--
IdSmtp.Host := ESMTP.Host;
IdSmtp.Username := ESMTP.User;
IdSmtp.Password := ESMTP.Passwort;
IdSmtp.Port := ESMTP.Port;
case ESMTP.Authen
of
0: IdSmtp.AuthType := satDefault;
1: IdSmtp.AuthType := satNone;
2: IdSmtp.AuthType := satSASL;
else
end;
//--
IdSmtp.Connect;
IdSmtp.Send(IdMessage);
RESULT:=True;
Finally
IdSmtp.Disconnect;
FreeAndNil(TS);
FreeAndNil(RS);
end;
end;