решил проблему
вот кидаете на форму
PHP код:
procedure TForm1.FormCreate(Sender: TObject);
begin
try
IdSMTP1.AuthenticationType:=atLogin;
IdSMTP1.Host:='smtp.rambler.ru';
IdSMTP1.Port:=25;
IdSMTP1.Username:='xxxxxxxxx@rambler.ru';
IdSMTP1.Password:='password';
IdSMTP1.Connect;
except
on e:Exception do
end;
end;
это на кнопку илу еще куданить
PHP код:
procedure TForm1.Button1Click(Sender: TObject);
var
msg:TIdMessage;
att:TIdAttachment;
begin
try
msg:=TIdMessage.Create(nil);
msg.Body.Add('email text');
msg.Subject:='header email';
msg.From.Address:='ххххххх@rambler.ru';//от кого отправляем
msg.From.Name:='Andrey';
msg.Recipients.EMailAddresses:='ххххххх@mail.ru';//кому отправляем
att:=TIdAttachment.Create(msg.MessageParts,'C:\1.txt');
msg.IsEncoded:=True;
if IdSMTP1.Connected=True then
begin
IdSMTP1.Send(msg);
end;
att.Free;
msg.Free;
except
on e:Exception do
begin
msg.Free;
att.Free;
IdSMTP1.Disconnect;
end;
end;
end;