Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Read POP3 Email over SSL
A Delphi programming example discussing POP3 SSL. // Read POP3 email over a secure SSL connection. // This Delphi example demonstrates how to use the Chilkat email component // to read email securely via SSL. The programming is identical to that // of reading over a non-SSL connection. The only difference is that // the mailman's PopSsl property should be set to 1, and the port number // should be changed to 995. Port 995 is the standard port used by POP3 // mail servers to listen for SSL connections. If your mail server's SSL // port is different, you should set it to the appropriate port number. procedure TForm1.Button5Click(Sender: TObject); var bundle: IChilkatEmailBundle2; begin // A ChilkatMailMan2 ActiveX component was dropped onto the Delphi // form, and this became the Form's member variable "ChilkatMailMan21". // Unlock the component -- only needs to be called once in a program. ChilkatMailMan21.UnlockComponent('Anything for 30-day trial'); // Set the POP3 mail server hostname, login, and password. ChilkatMailMan21.MailHost := 'mail.chilkatsoft.com'; ChilkatMailMan21.PopUsername := '***'; ChilkatMailMan21.PopPassword := '***'; // Indicate that we are establishing a POP3 SSL connection: ChilkatMailMan21.PopSsl := 1; ChilkatMailMan21.MailPort := 995; // Read the entire mailbox, leaving the mail on the POP3 server. bundle := ChilkatMailMan21.CopyMail(); if (bundle = nil) then ChilkatMailMan21.SaveLastError('errorLog.xml'); { If you try to connect to a POP3 server on a non-SSL port you will get the following error log. (Note, this would happen if you forget to change the port number to 995.) <ChilkatLog> <CopyMail> <pop3-ssl-connect> <info>Attempting to connect and log into POP3/SSL server</info> <hostname>mail.chilkatsoft.com</hostname> <port>110</port> <login>matt@chilkatsoft.com</login> <error>Invalid token.</error> <scRet>80090308</scRet> <error>Aborting because of fatal error</error> <error>Error performing handshake</error> <error>Failed to establish channel to Secure POP3 server</error> </pop3-ssl-connect> <error>Failed to get mail.</error> </CopyMail> </ChilkatLog> } { If you try to connect to a POP3 server using SSL, and your POP3 server is not listening at the port number (995), you will get this error because the connection times out: <ChilkatLog> <CopyMail> <pop3-ssl-connect> <info>Attempting to connect and log into POP3/SSL server</info> <hostname>mail.chilkatsoft.com</hostname> <port>995</port> <login>matt@chilkatsoft.com</login> <error>socket is not ready for writing</error> <error>Connection attempt timed out, trying again.</error> <sockError>10037</sockError> <error>Connect function failed.</error> <SocketError>Error 2735</SocketError> <error>Check to make sure the connection is not blocked by a firewall or anti-virus port filtering.</error> <error>Failed to establish channel to Secure POP3 server</error> </pop3-ssl-connect> <error>Failed to get mail.</error> </CopyMail> </ChilkatLog> } // ... // ... ShowMessage('Done!'); end;
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.