Привет всем...
Через 3 дня курсач здавать... а я оч плохо знаю делфи..
очтавил я делфи + инди
Задание просто почтовый клиент
нашел исходник в нете пофиксил чутка.. и не хочет работать нивкакой..
Я все понимаю, я студент, кк стипуха придет, расплачусь
вот код:
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdPOP3, IdMessage, IdSMTP, IdTCPServer,
IdPOP3Server;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
POP3: TIdPOP3;
IdMessage: TIdMessage;
Button2: TButton;
Button3: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Button4: TButton;
SMTP: TIdSMTP;
IdMessage1: TIdMessage;
IdPOP31: TIdPOP3;
IdSMTP: TIdSMTP;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
POP3.Host:='mail.inbox.lv';
POP3.Port:=110;
POP3.Username:='butamuh';
POP3.Password:='*****';
IdMessage.Clear;
POP3.Connect;
Memo1.Clear;
POP3.Retrieve(1,IdMessage);
Memo1.Lines.AddStrings(IdMessage.Body);
POP3.Delete(1);
POP3.Disconnect;
end;
procedure TForm1.Button2Click(Sender: TObject);
label f;
var
mailcicl:integer;
addr:string;
begin
POP3.Host:='mail.inbox.lv';
POP3.Port:=110;
POP3.Username:='butamuh';
POP3.Password:='*****';
addr:=ExtractFilePath(Application.ExeName);
POP3.Connect;
for mailcicl:=1 to 10 do
begin
if POP3.CheckMessages<1 then goto f ;
IdMessage.Clear;
Memo1.Clear;
POP3.Retrieve(1,IdMessage);
Memo1.Lines.AddStrings(IdMessage.Body);
Memo1.Lines.SaveToFile(addr+inttostr(mailcicl)+'.txt');
POP3.Delete(mailcicl);
end;
f:
POP3.Disconnect;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
i,numPosts: Integer;
begin
POP3.Host:='mail.inbox.lv';
POP3.Port:=110;
POP3.Username:='butamuh';
POP3.Password:='*****';
IdMessage.Clear;
POP3.Connect;
Memo1.Clear;
POP3.Retrieve(1,IdMessage);
Memo1.Lines.AddStrings(IdMessage.Body);
// вывод в компоненты Label информации о сообщении.
Label1.Caption := IdMessage.From.Text;
Label2.Caption := IdMessage.Recipients.EmailAddresses;
Label3.Caption := IdMessage.CCList.EMailAddresses;
Label4.Caption := IdMessage.Subject;
Label5.Caption := FormatDateTime('dd mmm yyyy hh:mm:ss', IdMessage.Date);
Label6.Caption := IdMessage.ReceiptRecipient.Text;
Label7.Caption := IdMessage.Organization;
POP3.Delete(1);
POP3.Disconnect;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
SMTP.Host:='mail2.inet.lv';
SMTP.Port:=25;
SMTP.Username:='butamuh';
SMTP.Password:='*****';
SMTP.AuthenticationType:=atLogin;
with IdMessage do
begin
Body.Assign(Memo1.Lines);
From.Text := 'butamuh@inbox.lv';
Recipients.EMailAddresses := 'butamuh@inbox.lv';
end;
SMTP.Connect;
try
showmessage('подключился');
SMTP.Send(IdMessage);
finally
SMTP.Disconnect;
end;
end;
end.
http://yy.lv/download.php?f=89213 - вот сам проет