Board index » delphi » Indy POP How to's

Indy POP How to's

Hi, i need to do the following tasks and have not a clue of how to:
1. Check for new mail and retrieve only the sender, date, subject, To,
CC and priority information. don't download bodies and attachments.
2. Delete messages from server without downloading them.

Thanks (I already had used the SMTP and POP components but in the
standard way, downloading the entire messages).
Using D6 Ent.
--
Guillermo Casta?o Acevedo
Gerente de Sistemas - Grupo Millennium Ltda
Guiller...@GrupoMillennium.com
http://www.GrupoMillennium.com

 

Re:Indy POP How to's


"Guillermo Casta?o A" <Guiller...@GrupoMillennium.com> wrote in message
news:3E1C5550.5050307@GrupoMillennium.com...

Quote
> Hi, i need to do the following tasks and have not a clue of how to:
> 1. Check for new mail and retrieve only the sender, date, subject, To,
> CC and priority information. don't download bodies and attachments.
> 2. Delete messages from server without downloading them.

> Thanks (I already had used the SMTP and POP components but in the
> standard way, downloading the entire messages).
> Using D6 Ent.

You didn't mention the Indy version, so I am assuming Indy 9...

Get a message count from the mail box using TIdPOP3.CheckMessages.

Use TIdPOP3.RetrieveHeader to retrieve only the headers for each message
number into a TIdMessage instance.

Store the headers you're looking for (or all of them even).

Use TIdPOP3.Delete for each message number.

Make sure you call TIdPOP3.Disconnect to physically remove messages marked
for deletion, or TIdPOP3.Reset to clear marked messages.

For example:

    iMsgCnt := IdPOP3.CheckMessages;
    for iMsgNo := 1 to iMsgCnt do
    begin
        IdMessage.Clear;
        IdPOP3.RetrieveHeader(iMsgNo, IdMessage);

        // store IdMessage properties of interest
        // or store all headers using IdMessage.Headers.Text
    end;
    for iMsgNo := iMsgCnt downto 1 do
    begin
        IdPOP3.Delete(iMsgNo);
    end;
    { IdPOP3.Reset;    // abandon deletions }
    IdPOP3.Disconnect;

hth...

--
Don Siders [Team Indy]

Join the Indy Docs project! (http://www.nevrona.com/indy/teams/docs)

ELKNews - Get your free copy at http://www.atozedsoftware.com

Re:Indy POP How to's


Quote
>"Guillermo Casta?o A" <Guiller...@GrupoMillennium.com> wrote in message
>news:3E1C5550.5050307@GrupoMillennium.com...

>> Hi, i need to do the following tasks and have not a clue of how to:
>> 1. Check for new mail and retrieve only the sender, date, subject, To,
>> CC and priority information. don't download bodies and attachments.
>> 2. Delete messages from server without downloading them.

>> Thanks (I already had used the SMTP and POP components but in the
>> standard way, downloading the entire messages).
>> Using D6 Ent.
>"Don Siders [Team Indy]" <mudsh...@apostrophe.net> wrote:

>Use TIdPOP3.RetrieveHeader to retrieve only the headers for each message
>number into a TIdMessage instance.

Guillermo, please note that this function relies on the POP3 "TOP"
command, which is OPTIONAL according to the POP3 RFC.   You cannot
count on all POP3 servers implementing it, and it is the only way to
get only a portion of the message.   You may need to track the response
from the
POP3 server to see if you get an -ERR when you issue the command,
and if so, you will be left with Hobson's choice -- retrieve the entire
message, including encoded attachments, or simply delete it.  It won't
happen that way very often (since TOP is strongly encouraged), but you
ought to be ready for it.... and TidPOP3 doesn't have this built in.

Jeff

Re:Indy POP How to's


Quote
"Jeff Woods" <j...@telix.com> wrote in message

news:3e1cbfcd$1@newsgroups.borland.com...

Quote
> Guillermo, please note that this function relies on the POP3 "TOP"
> command, which is OPTIONAL according to the POP3 RFC.

Good point.

Quote
> You may need to track the response
> from the POP3 server to see if you get an -ERR when
> you issue the command,

Actually, you should get an EIdProtocolReplyError if TOP isn't supported.

--
Don Siders [Team Indy]

Join the Indy Docs project! (http://www.nevrona.com/indy/teams/docs)

ELKNews - Get your free copy at http://www.atozedsoftware.com

Re:Indy POP How to's


Thanks to Don and Jeff for the very complete answers!!

Quote
Guillermo Casta?o A wrote:
> Hi, i need to do the following tasks and have not a clue of how to:
> 1. Check for new mail and retrieve only the sender, date, subject, To,
> CC and priority information. don't download bodies and attachments.
> 2. Delete messages from server without downloading them.

> Thanks (I already had used the SMTP and POP components but in the
> standard way, downloading the entire messages).
> Using D6 Ent.

--
Guillermo Casta?o Acevedo
Gerente de Sistemas - Grupo Millennium Ltda
Guiller...@GrupoMillennium.com
http://www.GrupoMillennium.com

Other Threads