Page 14 of 23

Posted: Mon Nov 19, 2007 10:07 pm
by Frontier
Ok, here's a really strange error.

Consider the following piece of code.

Code: Select all

For iMsg=1 To PurePOP3_CountMessages() ; retrieve each message and examine the header and if matched, save attachment
      If PurePOP3_RetrieveMessage(iMsg) > 0
        ; message retrieved successfully, process it
        AppLog("Λήψη Μηνύματος "+Str(iMsg),#False)
        AppLog("Επισυναπτόμενα μηνύματος: "+Str(PurePOP3_CountAttachedFiles()),#False)
        szFAtt$=""
        szID$=""
        sztmp1$=""
        sztmp2$=""
        msginfo$=PurePOP3_GetMessageInfo()
        If FindString(msginfo$,"net.314 MedSync:",1) 
          AppLog("Το μήνυμα είναι προβλεπόμενο.",#False)
        
          ; the message subject is  like this: net.314 MedSync: (ID) ...
          ; I need to get the ID
          sztmp1$=Right(msginfo$,Len(msginfo$)-FindString(msginfo$,"net.314 MedSync: (",1))
          sztmp2$=Right(sztmp1$,Len(sztmp1$)-FindString(sztmp1$,"(",1))
          szID$=StringField(sztmp2$,1,")")
                              
          ; get the attachment name
          szFAtt$=StringField(PurePOP3_ListAttachementsForMessage(),1,Chr(9))
          Debug szFAtt$
          
          ; now, save the attachment to the $BackupDir$\szID$ folder
          If PurePOP3_SaveAttachementsToFile(Backend\BackupDir+"\"+szID$) = #Null
            AppLog("Αδυναμία αποθήκευσης συννημμένων στο φάκελο "+Backend\BackupDir+"\"+szID$,#False)
          Else
            AppLog("Επιτυχής αποθήκευση αρχείου "+Backend\BackupDir+"\"+szID$,#False)
          EndIf
           
          ; extract the saved attachment to the $ExtractDir$\szID$ folder
          If PureZIP_ExtractFiles(Backend\BackupDir+"\"+szID$+"\"+szFAtt$, "*.*", Backend\ExtractDir+"\"+szID$, #False) = #Null
            AppLog("Αδυναμία αποσυμπίεσης αρχείου "+Backend\BackupDir+"\"+szID$+"\"+szFAtt$,#False)
          Else
            AppLog("Επιτυχής αποσυμπίεση αρχείου "+Backend\BackupDir+"\"+szID$+"\"+szFAtt$,#False)
            
            ; add the e-mail to the final e-mail notification queue
            szMessageNotification=szMessageNotification+"Successfully retrieved data from "+msClient(Val(szID$))\Label+" - "+szFAtt$+Chr(13)
                        
          EndIf
        Else
          ; mail is OK, but no attachments
          AppLog("Βρέθηκε μήνυμα αλλά όχι επισυναπτόμενο.",#False)
          AppLog("Διαγραφή μη προβλεπoμένου μηνύματος "+Str(PurePOP3_DeleteMessage(iMsg))+"("+PurePOP3_GetLastServerMessage()+")",#False)
        EndIf
      EndIf
    Next
    
    ; close the POP3 server
    PurePOP3_ClosePOP3Connection()
The AppLog() function just logs messages to a file and you can ignore the filename paths contained within the PureZIP and PurePOP3 commands; they execute properly.

Suppose we have a mail server (maxmail) with 4 messages. Each message has an attachment, so there are 4 attachments in total. The above code should iterate 4 times and save 4 attachements.

The only problem is that it runs only 3 times, right after executing this

Code: Select all

          ; extract the saved attachment to the $ExtractDir$\szID$ folder
          If PureZIP_ExtractFiles(Backend\BackupDir+"\"+szID$+"\"+szFAtt$, "*.*", Backend\ExtractDir+"\"+szID$, #False) = #Null
            AppLog("Αδυναμία αποσυμπίεσης αρχείου "+Backend\BackupDir+"\"+szID$+"\"+szFAtt$,#False)
          Else
            AppLog("Επιτυχής αποσυμπίεση αρχείου "+Backend\BackupDir+"\"+szID$+"\"+szFAtt$,#False)
it exit (abnormally I guess, but no errors are displayed). Control does not reach PurePOP3_ClosePOP3Connection() nor it populates correcly the szMessageNotification variable (string).

The code worked with PureBasic 4.10b2 and PurePOP3, but now it produces this result with PureBasic 4.10 final and the latest PurePOP3.

I am providing the debug files produced by PurePOP3_Debug() so that it will help tracking down what's possibly wrong with the code or the library itself.

Code: Select all

http://www.uploading.com/files/ULBGR6C5/PPOP3dbg.zip.html
Any ideas what might be wrong? The test system is Windows Server 2003 SP2 without any antivirus software. As you can see from the debug session, only 3 messages get dumped.

Many thanks in advance.

Posted: Tue Nov 20, 2007 9:07 am
by gnozal
Frontier wrote:...
The code worked with PureBasic 4.10b2 and PurePOP3, but now it produces this result with PureBasic 4.10 final and the latest PurePOP3.
Latest is PurePOP3-Installer.exe with md5 = 33a1aacba0d02ca07cf0b6fc8e08e90e .
So the problem appeared with PB4.10 final ?
I recompiled PurePOP3 with PB4.10 final. Could you try it : http://freenet-homepage.de/gnozal/PurePOP3_Test.zip ?
Frontier wrote:I am providing the debug files produced by PurePOP3_Debug() so that it will help tracking down what's possibly wrong with the code or the library itself.
Can't download the zip file, the (corporate) firewall says

Code: Select all

InterScan Web Security detected the following in HTTP traffic:

Item: http://f55.uploading.com/26c74238293f1d0ef12c9c055b73e639/4742e502/1/38/880/PPOP3dbg.zip
Action: deleted
Reason: Violation of a compressed file restriction

-- File: PPOP3dbg.zip, security warning: Corrupted_Zip_file
The uncleanable file is deleted.
Maybe try another host (I can't download from rabidshare and co)

Posted: Tue Nov 20, 2007 10:31 am
by Frontier
Hi gnozal,

The code seems to work now, but I will tell you more tomorrow when it will be scheduled to execute once more.

Please examine the logs I've sent you (see my PM) in case you think there is something else going wrong with the behaviour of my code with your library.

Again, thank you VERY much for your prompt answer and help :D

Posted: Tue Nov 20, 2007 12:14 pm
by gnozal
Frontier wrote:The code seems to work now, but I will tell you more tomorrow when it will be scheduled to execute once more.
Could you please confirm you were using the latest PurePOP3 version (md5 = 33a1aacba0d02ca07cf0b6fc8e08e90e) ?
And does it work with the latest release or the test library ?
Frontier wrote:Please examine the logs I've sent you (see my PM) in case you think there is something else going wrong with the behaviour of my code with your library.
I checked the logs, I didn't found any problem.

Posted: Tue Nov 20, 2007 12:23 pm
by Frontier
gnozal wrote:
Frontier wrote:The code seems to work now, but I will tell you more tomorrow when it will be scheduled to execute once more.
Could you please confirm you were using the latest PurePOP3 version (md5 = 33a1aacba0d02ca07cf0b6fc8e08e90e) ?
And does it work with the latest release or the test library ?
Frontier wrote:Please examine the logs I've sent you (see my PM) in case you think there is something else going wrong with the behaviour of my code with your library.
I checked the logs, I didn't found any problem.
Hello,

The code works ONLY when using the TEST version of PurePOP3 library, nothing else.

The logs (STAT command) mention 4 messages, yet the old (not the TEST) library downloads 3 messages.

Posted: Tue Nov 20, 2007 12:26 pm
by gnozal
Frontier wrote:Hello,
The code works ONLY when using the TEST version of PurePOP3 library, nothing else.
The logs (STAT command) mention 4 messages, yet the old (not the TEST) library downloads 3 messages.
Thanks.
Could you please tell me if the TEST version also works with PB4.02 ?

Posted: Tue Nov 20, 2007 1:00 pm
by Frontier
gnozal wrote:
Frontier wrote:Hello,
The code works ONLY when using the TEST version of PurePOP3 library, nothing else.
The logs (STAT command) mention 4 messages, yet the old (not the TEST) library downloads 3 messages.
Thanks.
Could you please tell me if the TEST version also works with PB4.02 ?
I do no longer have v4.02 installed :(

Posted: Tue Nov 20, 2007 1:51 pm
by gnozal
Update

Changes :
- added a PB4.10 version (same code, just recompiled with PB 4.10 final)

Posted: Tue Jan 08, 2008 12:47 pm
by bobobo
Notice
4.20Beta - Your nice lib throws an PolinkError referring to _PB_Mid (SubSystems also) while trying to compile

Posted: Tue Jan 08, 2008 1:14 pm
by gnozal
bobobo wrote:Notice
4.20Beta - Your nice lib throws an PolinkError referring to _PB_Mid (SubSystems also) while trying to compile
Version compiled with PB4.20 beta 1 : http://freenet-homepage.de/gnozal/PurePOP3___.zip (not tested).

Posted: Tue Jan 08, 2008 1:58 pm
by bobobo
:D ok now

THANK YOU

Posted: Mon Feb 25, 2008 1:45 pm
by akee
How do you get mail from GMail? I seem to receive a Server Timeout message... :(

Code: Select all

Server.s = "pop.gmail.com" 
Port.l = 995
User.s = "myemail@gmail.com" 
Pwd.s = "mypassword" 
; 
If PurePOP3_OpenPOP3Connection(Server, Port, User, Pwd) = #PurePOP3_Ok 
  Debug "Connected" 
  ; PurePOP3_Trace(#TRUE) 
  Messages = PurePOP3_CountMessages() 
  Debug "You have " + Str(Messages) + " messages(s)" 
  If Messages 
    Debug "Message(s) total size : " + Str(PurePOP3_GetMessagesTotalSize()) + " bytes" 
    Debug "Message " + Str(Messages) + " size : " + Str(PurePOP3_GetMessageSize(Messages)) + " bytes" 
    Debug "Retrieve message " + Str(Messages) 
    If PurePOP3_RetrieveMessage(Messages) > 0 
      Debug "--------------" 
      Debug "Message info : " + PurePOP3_GetMessageInfo() 
      *Message = PurePOP3_GetMessageTextInMemory() 
      If *Message 
        Debug "Message text :" 
        Debug "" 
        Debug PeekS(*Message) 
        Debug "" 
        FreeMemory(*Message) 
      EndIf 
      Attachements.s = PurePOP3_ListAttachementsForMessage() 
      If Attachements 
        Debug "----------------" 
        Debug "Attachement(s) : " + Attachements 
        If PurePOP3_SaveAttachementsToFile("") 
          Debug "Attachement(s) saved to current directory" 
        Else 
          Debug "Could not save attachement(s)" 
        EndIf 
      Else 
        Debug "--------------" 
        Debug "No attachments" 
      EndIf 
    EndIf 
  EndIf 
  PurePOP3_ClosePOP3Connection() 
Else 
  Debug PurePOP3_GetLastServerMessage() 
EndIf 

Posted: Mon Feb 25, 2008 1:49 pm
by srod
Does gMail not use ssl or tls ?

If so, then this lib will not help. Accessing e-mail via ssl is very very difficult.

Posted: Mon Feb 25, 2008 1:53 pm
by gnozal
Srod is right : PurePOP3 doesn't support SSL.

Posted: Tue Feb 26, 2008 5:28 am
by GeoTrail
Gmail requires SSL for POP. SMTP requires TLS :)