PurePOP3 library : POP3 functions

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

..::Origin::..
Enthusiast
Enthusiast
Posts: 125
Joined: Sat Jun 17, 2006 3:15 pm

Post by ..::Origin::.. »

Apologies for the old topic bump, but is there a way to use this with GMAIL? I followed GMAILS configuration instructions, i keep getting nothing from the server.

Thanks, ..::Origin::..
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

..::Origin::.. wrote:Apologies for the old topic bump, but is there a way to use this with GMAIL?
No.
Gmail does not use 'standard POP3', but SSL.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Hi gnozal.
Have some trouble with the POP lib. probably my fault, but anyways, you can probably help

I have 3 email messages on my pop account, but when I run this code:

Code: Select all

  Messages = PurePOP3_CountMessages()
  Debug "You have " + Str(Messages) + " messages(s)"
  
  If Messages
    For i=0 To Messages
      PurePOP3_RetrieveMessage(i, "E:\Email-"+Str(i)+".txt")
      Debug "Message info : " + PurePOP3_GetMessageInfo()
      *Message = PurePOP3_GetMessageTextInMemory()
      If *Message
        Debug "Message text : " + PeekS(*Message)
        FreeMemory(*Message)
      EndIf
      Debug "---------------------------------"
    Next i
  EndIf
it is supposed to save the email messages to files but that only happens for the two first files it seems. It counts all three messages with PurePOP3_CountMessages() and it displays the messages in the debug window, but it only saves Email-1.txt and Email-2.txt to disk, there is no Email-3.txt can you spot any errors I may have made here?
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Code: Select all

If Messages 
    For i=0 To Messages 
      PurePOP3_RetrieveMessage(i, "E:\Email-"+Str(i)+".txt")
Shouldn't that be '1 to Messages'.

Don't know if that works, but might help.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

I can't test it now (no POP3 server) but IIRC I always used

Code: Select all

For i = 1 To Messages
where i is the message number (can't be 0 I think).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

I have tried with both 0 and 1 and there doesn't seem to be any difference. I get the same result. And I don't get any error messages.
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

GeoTrail wrote:I have tried with both 0 and 1 and there doesn't seem to be any difference. I get the same result. And I don't get any error messages.
Please :
- post a complete code snippet
- enable the trace mode [ PurePOP3_Trace(#True) ] and post the PurePOP3-DEBUG*.txt files [replace your password with XXX :wink:]
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

The source is the source from the help file that I modified alittle

Code: Select all

PurePOP3_Trace(#True)
If PurePOP3_OpenPOP3Connection("pop.online.no", 110, "USER", "PASSWRD") = #PurePOP3_Ok
  Debug "Connected"
  Messages = PurePOP3_CountMessages()
  Debug "You have " + Str(Messages) + " messages(s)"
  
  If Messages
    For i=0 To Messages
      PurePOP3_RetrieveMessage(i, "E:\Email-"+Str(i)+".txt")
      Debug "Message info : " + PurePOP3_GetMessageInfo()
      *Message = PurePOP3_GetMessageTextInMemory()
      If *Message
        Debug "Message text : " + PeekS(*Message)
        FreeMemory(*Message)
      EndIf
      Debug "---------------------------------"
    Next i
  EndIf
  
  PurePOP3_ClosePOP3Connection()
Else
  Debug PurePOP3_GetLastServerMessage()
EndIf
It does seem to work now though. I had 5 email messages on the server and it now creates 5 email files. Could there be something wrong with the pop server?
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

GeoTrail wrote:It does seem to work now though. I had 5 email messages on the server and it now creates 5 email files.
Good :D
GeoTrail wrote: Could there be something wrong with the pop server?
Could be, that's why I asked for the log files. I have the impression that POP3 is a very non standard standard ! I had a lot of surprises with different servers.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Post by Shardik »

@gnozal:

I tried to download your POP3 User Lib but I always get the following warning from our SonicWall appliance:
This request is blocked by the SonicWALL Gateway Anti-Virus Service. Name: Suspicious.2#upack (Worm)
Would you please be so kind and do a virus test on your PurePOP3 PB 4 zip archive http://freenet-homepage.de/gnozal/PurePOP3_.zip to make sure that it doesn't contain the above mentioned worm?
Or is this definitely a false positive warning?
jpd
Enthusiast
Enthusiast
Posts: 167
Joined: Fri May 21, 2004 3:31 pm

Post by jpd »

Hi Shardik,

is definitely a F.P.

Best
jpd
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Shardik wrote:Would you please be so kind and do a virus test on your PurePOP3 PB 4 zip archive http://freenet-homepage.de/gnozal/PurePOP3_.zip to make sure that it doesn't contain the above mentioned worm?
Or is this definitely a false positive warning?
It is a false positive. The SFX is packed with WinUpack, hence the virus warning.
Still, if you have any doubt, you can open PurePOP3-Installer.exe in your favorite packer (WinRAR, 7-ZIP, etc..) like a ZIP archive and manually extract the files without starting the exe itself.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Post by Shardik »

@jpd and gnozal

Thank you for your fast replies!
gnozal wrote: Still, if you have any doubt, you can open PurePOP3-Installer.exe in your favorite packer (WinRAR, 7-ZIP, etc..) like a ZIP archive and manually extract the files without starting the exe itself.
My first try to download the file was successful. But when opening the archive, WinZip reported that the archive is not valid or corrupted. Therefore I retried the download several times and always received the above warning and SonicWALL refused to permit the download again. But I will retry the download when arriving at home in the evening because I don't have the administrative rights to disable the SonicWALL at work. :(
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update (Both versions)

- some internal changes in PurePOP3_RetrieveMessage()
- added POP3 server time out, to avoid infinite loops
- new function PurePOP3_SetTimeOut()
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Great work as usual gnozal. Thanks alot :)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
Post Reply