Pros?m v?s o pomoc. Potrebujem naprogramova? v Delphi 7 pr?jem po?ty cez IdPOP3. No neviem si s t?m rady. Potrebujem zisti? po?et spr?v na mail.konte a na??ta? mail.spr?vu asi najlep?ie do IdMessage. A nikde o tom neviem n?jis?. ?akujem
Fórum › Delphi
IdPOP3 v Delphi 7 - help

?au. Kdysi jsem d?lal n?co podbn?ho:
Na formul?? si ho? jeden listbox, jedno memo, jedno tla??tko a 3 edity (ty pojmenuj pop3server, user_name a password) a pak komponenty idPOP3, idMessage a idAntiFreeze (ta je proto, aby p?i stahov?n? dat ze serveru aplikace nezamrzala) a tady je celej k?d:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdPOP3, IdMessage, IdAntiFreezeBase,
IdAntiFreeze;
type
TForm1 = class(TForm)
IdPOP31: TIdPOP3;
Button1: TButton;
pop3server: TEdit;
user_name: TEdit;
password: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ListBox1: TListBox;
IdMessage1: TIdMessage;
IdAntiFreeze1: TIdAntiFreeze;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ListBox1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var celkemzprav,i: integer;
begin
ListBox1.Clear;
idPOP31.Host:=pop3server.Text;
idPOP31.Username:=user_name.Text;
idPOP31.Password:=password.Text;
IdPOP31.Connect(); //p?ipojit se k POP3 serveru
if not idPOP31.Connected then exit;
celkemzprav:=idPOP31.CheckMessages; //vr?t? po?et zpr?v na serveru
for i:=1 to 10 do begin //postupn? po na?te hlavi?ky v?ech zpr?v
if not idPOP31.RetrieveHeader(i,IdMessage1) then break;
ListBox1.Items.Add(idmessage1.From.Text+' | '+idmessage1.Subject);
//a vyp??e odes?latele a p?edm?t do Listoboxu
Application.ProcessMessages;
idMessage1.Clear;
end;
idPOP31.Disconnect;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if idPOP31.Connected then idPOP31.Disconnect;
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
//p?i dvojkliku na n?jakou zpr?vu v Listboxu
begin
Memo1.Clear;
if not idPOP31.Connected then idPOP31.Connect();
idPOP31.RetrieveRaw(ListBox1.ItemIndex+1,Memo1.Lines); //st?hneme p??slu?nou zpr?vu
idPOP31.Disconnect;
end;
end.
M?lo by to fungovat. Do t?ch t?? pol? mus?? vyplnit pop3 server, u?ivatelsk? jm?no a heslo. Kliknut?m na tla??tko se kontrola spust?. Je?t? si tam m??e? dod?lat r?zn? pt?kovinky jako je mo?nost p?eru?en? stahov?n? apod....zpr?vy se stahujou od nejstar??ch (teda aspo? na Seznamu), ale i to si m??e? upravit.
Kdyby n?co nefungovalo tak mi napi? na ICQ 249-163-429.
To Jackxl: Řekl bych, že záleží dost na typu mobilu...navíc nevím jak vypadá hlavička normálního e-mailu natož emailu z mobilu :) tohle je navíc jen ukázka toho, jak by to mohlo být - pokud se má jednat o profesionálnější program tak je samozřjemě nutné si to upravit
Mimochodem - jestli nemáš co dělat tak to můžeš zkusit upravit aby to fungovalo ;)

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 12 hostů
Podobná vlákna
C++ vs.Delphi — založil Dávid Ivan
Fórum na Delphi.cz — založil kartago
Kurz Delphi — založil Daniel Muška