![]() |
|
|
Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
|
Опции темы | Поиск в этой теме | Опции просмотра |
#1
|
|||
|
|||
![]() здраствуйте, есть файл (c:\file.txt) в нём находеться 5 адресов файлах на компе (на_пример: D:\file\progra.exe и т.д..)
задачя- создать програму корорая читает строки из файла (а именно адрес файлох) и передать их на почту! вот прога , но не работает почему-то... за ранее блогодарен. Код:
procedure mail; var smtp : TIdSMTP; msg : TIdMessage; attach: TidAttachment; fi : System.Text; text : string; begin AssignFile(fi,'C:\file.txt'); Reset(fi); smtp := TIdSMTP.Create(nil); smtp.AuthenticationType := atLogin; smtp.Username := 'username'; smtp.Password := 'password'; smtp.Host := 'smtp.yandex.ru'; smtp.Port := 25; smtp.Connect; if smtp.Authenticate then begin msg := TIdMessage.Create(nil); msg.Subject := 'subject'; msg.Body.Add('Attachement file:'); msg.From.Text := 'xxx@yandex.ru'; msg.Recipients.EMailAddresses := xxx@yandex.ru'; while not eof(fi) do begin while not eoln(fi) do begin read (fi, text); end; end; attach:=TIdAttachment.Create(msg.MessageParts, TFileName(text)); smtp.Send(msg); smtp.Disconnect; msg.Free; end; smtp.Free; CloseFile(fi); end; Последний раз редактировалось webmastersky1, 28.11.2010 в 14:28. |