Link to home
Start Free TrialLog in
Avatar of LeTay
LeTay

asked on

How to delete a POP3 message with Delphi ?

Delete method of TidPOP3 component
I retrieve a message from the POP server : idPOP3.Retrieve(N,M) where M is a TIdMessage
I process the message and then I delete it with idPop3.Delete(N)
But the message is still there !
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

As I can test and the others too .... there is noway to delete message using pop protocol on GMail. Look similar question here... and solution part.
They sugget to use IMAP protocol. Pop hides once fetched message - and delete would not work after that.
Avatar of LeTay
LeTay

ASKER

Well, your answer looks very strange !
What should then perform the "delete" function of the TIdPOP3 component ?
On the other hand, I have another application doing the same and it works (accessing another email server)
Yes, as you said... another!
Gmail do not allow this. And that is it. Try you app with "another" server.
Avatar of LeTay

ASKER

Well, nice, but not possible, I have to use gmail server
So the question now is, after processing all these incoming emails on gmail with POP3 component, how can I delete all theses messages programmatically ?
Thanks
I point you to use IMAP protocol with gmail. Because IMAP works with folders - then one solution is to move message to trash (folder).
Harder solution is to use Gmail/Google api.
Avatar of LeTay

ASKER

Well, I configured the gmail account that I need to access from my application via the gmail interface
I activated (of course) the POP protocol and set the option that retrieved message must be deleted
But this does not seem to work
If I can't do all that with the POP protocol, is there a IMAP component for Delphi ?
Indy have IMAP4 component. Look here on Emp forum little description by Remy. It is very similar to POP3 component but IMAP uses/lists folders.
Simple example of how to use: http://delphidevshare.blogspot.com/2009/06/connecting-with-gmail-through-imap-with.html
...and Delphi email client project here.
Avatar of LeTay

ASKER

Hello,
I was wrong about the fact that the mail was not deleted when retrieved (action by gmail, not my code) : it is, indeed !
So I can continue to use POP3
ASKER CERTIFIED SOLUTION
Avatar of LeTay
LeTay

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial