SelectClientCert Method
Reads a certificate from the specified store
and makes it active certificate that MailBee will use to represent the client
to the mail server.
Most (but not all) mail servers do not require any client certificate (anonymous
certificate is accepted). So, you do not need to call this method unless your
mail server requires client certificate.
As a minimum, only certificate store name and type required for this method.
First certificate in the store will be automatically selected. However, you
can specify particular certificate in the store by using optional parameters
of the method.
To deselect any client certificate (if you want to revert to anonymous certificate),
just call this method with empty Path argument.
Selected certificate information will be accessible through ClientCert
property.
Note: This method will make effect only if it called
BEFORE connecting to the mail server.
blnResult = ObjectName.SelectClientCert(Path, StoreType, [IssuedTo], [IssuedBy], [FriendlyName], [PrivateKey]) |
Parameters: | ||
Path As String | Filename or system registry name of
the store. Allowed system registry names are:
|
|
StoreType As Long | Type of the certificate store to select
certificate from. Allowed values are:
|
|
IssuedTo As String | (optional) If specified, only certificates with given Issued To name will be considered during search | |
IssuedBy As String | (optional) If specified, only certificates with given Issued By name will be considered during search | |
FriendlyName As String | (optional) If specified, only certificates with given Friendly Name will be considered during search | |
PrivateKey As String | (optional) Private key of PFX file. This parameter is valid for PFX file stores only | |
Return value As Boolean | True if successful, False if no corresponding certificate was found |
Usage example:
Dim Mailer 'Using visual basic to create object Set Mailer = CreateObject("MailBee.SMTP") 'Using ASP to create object 'Set Mailer = Server.CreateObject("MailBee.SMTP") 'In ASP use Response.Write instead of MsgBox Mailer.EnableLogging = True Mailer.LogFilePath = "C:\Temp\smtp_log.txt" Mailer.ClearLog Mailer.LicenseKey = "put your license key here" ' Set SSL connection over STARTTLS command Mailer.SSL.UseStartTLS = True Mailer.SSL.Enabled = True ' It's assumed "C:\admin.cer" is a valid certificate Mailer.SSL.SelectClientCert("C:\admin.cer", 1) ' select active certificate MsgBox Mailer.SSL.ClientCert.IssuedBy ' display info on who issued the certificate to the client
See Also:
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.