![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Lianja) POP3 Verify Signed (S/MIME) EmailDemonstrates how to download and verify digitally signed S/MIME email. Note: This example requires Chilkat v11.0.0 or greater.
llSuccess = .F. // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loMailman = createobject("CkMailMan") // Set the POP3 server's hostname loMailman.MailHost = "pop.example.com" // Set the POP3 login/password. loMailman.PopUsername = "myLogin" loMailman.PopPassword = "myPassword" loStUidls = createobject("CkStringTable") llSuccess = loMailman.FetchUidls(loStUidls) if (llSuccess = .F.) then ? loMailman.LastErrorText release loMailman release loStUidls return endif loEmail = createobject("CkEmail") loCert = createobject("CkCert") lnCount = loStUidls.Count i = 0 do while i < lnCount // Download the full email. llSuccess = loMailman.FetchByUidl(loStUidls.StringAt(i),.F.,0,loEmail) if (llSuccess = .F.) then ? loMailman.LastErrorText release loMailman release loStUidls release loEmail release loCert return endif ? str(i) ? "From: " + loEmail.From ? "Subject: " + loEmail.Subject // The security layers of signed and/or encrypted emails // are automatically "unwrapped" when loaded into // a Chilkat email object. // An application only needs to check to see if an email // was received signed or encrypted, and then examine // the success/failure. For example: if (loEmail.ReceivedSigned = .T.) then ? "This email was signed." // Check to see if the signatures were verified. if (loEmail.SignaturesValid = .T.) then ? "Digital signature(s) verified." ? "Signer: " + loEmail.SignedBy llSuccess = loEmail.LastSignerCert(0,loCert) if (llSuccess = .F.) then ? loEmail.LastErrorText release loMailman release loStUidls release loEmail release loCert return endif ? "Signing cert: " + loCert.SubjectCN endif else ? "Digital signature verification failed." endif i = i + 1 enddo loMailman.Pop3EndSession() release loMailman release loStUidls release loEmail release loCert |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.