нужны компоненты "SMTP" и "IdMessage"
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ...
var AT: TIdAttachmentFile;
begin
with IdMessage1 do
begin
SMTP . Host:=Host;
SMTP . Port:=Port;
SMTP . Username:=Username;
SMTP . Password:=Pas;
Subject:= 'Картинка' ;
body . Clear;
body . Text:= 'Вам картинка' ;
if FileExists( 'C:\путь до файла' ) then
AT:=TIdAttachmentFile . Create(MessageParts, 'C:\путь до файла' );
Recipients . EMailAddresses:=Aдрес получателя;
ContentType:= 'multipart/mixed; charset=windows-1251' ;
ContentTransferEncoding:= '8bit' ;
try
SMTP . Connect;
SMTP . Send(IdMessage1);
finally
SMTP . Disconnect;
AT . free;
end ;
end ;
...
|