Ben Hochstrasser [FF] Guest
|
Posted: Wed Jan 21, 2004 5:49 pm Post subject: Re: synapse & imap |
|
|
Antonello Carlomagno wrote:
| Quote: | Someone can help me to create a client imap with synapse? examples ?
|
The example below will login, fill ListBox1 with the root folders (inbox,
trash, etc) and copy the headers of the message in the inbox into Memo1.
Should get you started...
procedure TForm1.Button1Click(Sender: TObject);
var
imap: TImapSend;
n: integer;
sl: TStringList;
begin
sl := TStringList.Create;
imap := TImapSend.Create;
imap.Username := 'userid';
imap.Password := 'password';
imap.TargetHost := 'imap.server.domain';
if imap.Login then
begin
Memo1.Clear;
// get the folder list into ListBox1
imap.List('', Listbox1.Items);
// select the Inbox
if imap.SelectFolder('inbox') then
begin
// loop through the items
for n := 1 to imap.SelectedCount do
begin
// get each message's header
if imap.FetchHeader(n, sl) then
begin
// and append them to a TMemo
Memo1.Lines.AddStrings(sl);
Memo1.Lines.Append('');
end;
end;
imap.CloseFolder;
end;
imap.Logout;
end;
imap.Free;
sl.Free;
end;
--
Ben
|
|