предварительно на форму нужно будет бросить
TIdMessage с вкладки
Indy Misc
по-моему самый простой способ:
Код:
var
e: exception;
begin
with IdMessage1 do
begin
Body.Text := 'текст';
From.Text := 'от кого';
Recipients.EMailAddresses := 'кому';
Subject := 'тема';
Priority := mpNormal;
end;
with IdSMTP1 do
begin
AuthenticationType := atLogin;
Username := 'юзер';
Password := 'пароль';
Host := 'smtp.mail.ru';
Port := 25;
Connect;
try
Send(IdMessage1);
except on e:exception do
begin
if e.Message = 'Incorrect authentication data'#13#10 then ShowMessage('Ошибка авторизации');
end;
end;
Disconnect;
end;
end;