Показать сообщение отдельно
  #10  
Старый 14.01.2011, 18:56
hackvl hackvl вне форума
Прохожий
 
Регистрация: 14.01.2011
Сообщения: 28
Репутация: 10
По умолчанию

решил проблему
вот кидаете на форму
PHP код:
procedure TForm1.FormCreate(SenderTObject);
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(SenderTObject);
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
Ответить с цитированием