Author |
|
nabunod Newbie
Joined: 20 March 2007 Location: United States
Online Status: Offline Posts: 1
|
Posted: 20 March 2007 at 11:45am | IP Logged
|
|
|
If anyone is interested, the following VFP code works successfully to connect via SSL to gmail POP3 accounts.
Code:
* Create POP3 object
oPOP3 = CreateObject("MailBee.POP3")
* Unlock POP3 object
oPOP3.LicenseKey = "yourPOP3licensekey"
* Create SSL object
oSSL = CreateObject("MailBee.SSL")
* Unlock SSL object
oSSL.LicenseKey = "yourSSLlicensekey"
* Set the POP3 Object SSL property to the SSL object
oPOP3.SSL = oSSL
* Enable logging POP3 session into a file
oPOP3.EnableLogging = .T.
oPOP3.LogFilePath = "C:\pop3_log.txt"
* Set POP3 server Variables
oPOP3.ServerName = "pop.gmail.com"
oPOP3.PortNumber = 995
* Set user credentials
oPOP3.UserName = "yourusername@domain.com"
oPOP3.Password = "yourpassword"
* Connect to the server and log in the mailbox
IF oPOP3.Connect()
* Download first message completely
oMsg = oPOP3.RetrieveSingleMessage(1)
IF !oPOP3.IsError()
* Display message body
MESSAGEBOX(oMsg.BodyText)
ELSE
* Display error information
MESSAGEBOX( "Error #" + ALLTRIM(STR(oPOP3.ErrCode,10,0)) + ", " + oPOP3.ErrDesc)
ENDIF
* Close the connection
llsuccess = oPOP3.Disconnect()
ELSE
* Display error information
MESSAGEBOX("Error #" + ALLTRIM(STR(oPOP3.ErrCode,10,0)))
MESSAGEBOX("Server response: " + oPOP3.ServerResponse)
ENDIF
RELEASE oPOP3
RELEASE oSSL
*This was translated from the the VB example in the Documentation for use in VFP. |
|
|
Nabu
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 20 March 2007 at 12:10pm | IP Logged
|
|
|
Thank you for the sample code you provided.
Best regards,
Andrew
|
Back to Top |
|
|