Код тривиальный:
Код: ...
SMTP: TIdSMTP;
IdMessage: TIdMessage;
...
procedure SendMail(Login,Password,Command:String);
begin
SMTP.Username:=Login;
SMTP.Password:=Password;
SMTP.Connect;
if SMTP.Connected then
begin
with IdMessage do
begin
Body.Clear;
Body.Add(Command);
From.Address:='xxx@xxx.ru';
Recipients.EMailAddresses := 'yyy@yyy.ru';
Subject := 'zzz';
end;
Try
Try
SMTP.Send(IdMessage);
Finally
SMTP.Disconnect;
End;
Except
End;
end;
end;
Код: ...
SMTP: TIdSMTP;
IdMessage: TIdMessage;
...
procedure SendMail(Login,Password,Command:String);
begin
SMTP.Username:=Login;
SMTP.Password:=Password;
SMTP.Connect;
if SMTP.Connected then
begin
with IdMessage do
begin
Body.Clear;
Body.Add(Command);
From.Address:='xxx@xxx.ru';
Recipients.EMailAddresses := 'yyy@yyy.ru';
Subject := 'zzz';
end;
Try
Try
SMTP.Send(IdMessage);
Finally
SMTP.Disconnect;
End;
Except
End;
end;
end;