Chilkat HOME ASP Visual Basic VB.NET C# C C++ MFC Delphi FoxPro Java Perl Python Ruby SQL Server VBScript
POP3 Verify Signed (S/MIME) EmailDemonstrates how to download and verify digitally signed S/MIME email.
<?php $mailman = new COM("Chilkat.MailMan2"); // Any string argument automatically begins the 30-day trial. $success = $mailman->UnlockComponent('30-day trial'); if ($success != true) { print $mailman->lastErrorText() . "\n"; exit; } // Set the POP3 server's hostname $mailman->MailHost = 'mail.chilkatsoft.com'; // Set the POP3 login/password. $mailman->PopUsername = 'myLogin'; $mailman->PopPassword = 'myPassword'; // sa is a Chilkat.CkStringArray $sa = $mailman->GetUidls(); if (is_null($sa)) { print $mailman->lastErrorText() . "\n"; exit; } $n = $sa->Count; for ($i = 0; $i <= $n - 1; $i++) { $uidl = $sa->getString($i); // email is a Chilkat.Email $email = $mailman->FetchEmail($uidl); if (is_null($email)) { print $mailman->lastErrorText() . "\n"; break; } print $email->from() . "\n"; print $email->subject() . "\n"; // 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 ($email->ReceivedSigned == true) { print 'This email was signed.' . "\n"; // Check to see if the signatures were verified. if ($email->SignaturesValid == true) { print 'Digital signature(s) verified.' . "\n"; print 'Signer: ' . $email->signedBy() . "\n"; // The certificate used for signing may be obtained // by calling email.GetSignedByCert. // cert is a Chilkat.Cert $cert = $email->GetSignedByCert(); if (is_null($cert)) { print 'Failed to get signing certificate object.' . "\n"; } else { print 'Signing cert: ' . $cert->subjectCN() . "\n"; } } else { print 'Digital signature verification failed.' . "\n"; } } } $mailman->Pop3EndSession(); ?> |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.