Page 1 of 1
AWPB-Tools
Posted: Mon Jul 28, 2014 3:41 pm
by captain_skank
Any body use ( or used ) the AWPB-Tools library ??
I've had a look at it and it seems to do most of what I want - but I cant figure how to delete a mail using POP3.
Cheers
Re: AWPB-Tools
Posted: Thu Aug 14, 2014 1:58 pm
by lule
hi,
http://www.purebasic.fr/english/viewtop ... 12&t=51959
HeX0R created a lib similar to AWPB. For deleting an email via pop3 :
Code: Select all
Procedure.i __POP3_DeleteMail(*THIS._POP3_MAIN_STRUCTURE_, Index.i)
Protected Result, a$
;Mails will not get deleted immediately!
;They will be deleted, when sending a "QUIT" to the server.
;That means you could undo all of your DELE-Messages
;when sending a RSET before QUIT
;(See below procedure)
If *THIS\ConnectionID = #Null
*THIS\LastError = #POP3_ERROR_NO_CONNECTION
ProcedureReturn 0
ElseIf *THIS\MessageCount < Index Or Index < 1
*THIS\LastError = #POP3_ERROR_INDEX_OUT_OF_BOUNDS
ProcedureReturn 0
EndIf
If __POP3_Internal_SendString(*THIS, "DELE " + Str(Index) + #CRLF$) > 0
a$ = __POP3_Internal_WaitForResponse(*THIS)
If __POP3_Internal_CheckResponse(*THIS, a$)
*THIS\LastResponse = Left(*THIS\LastResponse, Len(*THIS\LastResponse) - 3)
Result = #True
*THIS\LastError = #POP3_ERROR_NONE
Else
*THIS\LastError = #POP3_ERROR_UNABLE_TO_DELETE_MAIL
EndIf
Else
*THIS\LastError = #POP3_ERROR_SENDING
EndIf
ProcedureReturn Result
EndProcedure
But he indicate Mails will not be deleted immediatly...., just after sending a quit to the server.
Code in AWPB-TOOLS :
Code: Select all
Procedure.i ____AWPB_POP3Client_DELE(*this.____AWPB_POP3Client, index.i)
Protected res.i, retries.i, done.b
retries = *this\Conn\Retries
res = #AWPB_POP3_ERR_FAIL
done = #False
If *this\Conn\ConnID
Repeat
If ____NW_Execute(*this\Conn, "DELE " + Str(index), *this\Conn\Retries)
Select *this\Conn\ResultCode
Case #____NW_CD_OK: res = #AWPB_POP3_ERR_NONE : done = #True
Case #____NW_CD_ERR: res = #AWPB_POP3_ERR_FAIL : done = #True
Default: res = #AWPB_POP3_ERR_FAIL : retries - 1
EndSelect
Else
retries - 1
EndIf
Until done Or (retries <= 0)
EndIf
ProcedureReturn res
EndProcedure