Back to product page
- Introduction
- License agreement
- Getting Started
- Enumerations
- Objects
- wodSmtp
- Methods
- Properties
- Authentication
- Blocking
- Certificate
- CharSet
- DNSHostname
- Hostname
- LastError
- LastErrorText
- Login
- MailFrom
- MailTo
- Message
- MyHostname
- MyIP
- Notification
- Password
- Port
- ProxyHostname
- ProxyLogin
- ProxyPassword
- ProxyPort
- ProxyType
- RequestReceipt
- RetryCount
- RetryWait
- Security
- State
- StateText
- Tag
- Timeout
- Transcript
- UseIPv6
- Version
- Events
- IwodSmtpClientNotify
- SmtpEncoder
- SmtpHdr
- SmtpHdrs
- SmtpMsg
- SmtpMsgs
- wodSmtp
- How to get support?
- Technical information
- Fast notifications interface
- Error list
Encrypt Method
Digitally encrypts the message.
Syntax
- Basic
object.Encrypt (RecipientCert)
The Encrypt(object,RecipientCert) syntax has these parts:
The Encrypt(object,RecipientCert) syntax has these parts:
object | An expression evaluating to an object of type SmtpMsg |
RecipientCert | Required. A Variant value. Reference to ICertificate instance that holds certificate of person that will receive the message. |
Remarks
Encrypt method will digitally encrypt your message before it's delivered to the recipient. You need valid certificate of the recipient in order to encrypt a message. Messages are encrypted using S/MIME version 3 specification, and only intended recipient (one who has the private key that corresponds the certificate used in encryption process) can decrypt and open the message.Typical usage will be like this:
' initialize wodSmtp and create some message
Dim Smtp1 As New wodSmtpCom
Smtp1.CreateSimple "someone@somehost.com", "recipient@otherhost.com", "Subject goes here", "Text goes here"
' now initialize certificate and load your personal certificate
Dim cert As New Certificate
cert.Load "c:\mbx\joe.pfx"
'and encrypt the message
Smtp1.Message.Encrypt cert
' optionally, save the message
Smtp1.Message.Save App.Path & "\encrypted.eml"
Dim Smtp1 As New wodSmtpCom
Smtp1.CreateSimple "someone@somehost.com", "recipient@otherhost.com", "Subject goes here", "Text goes here"
' now initialize certificate and load your personal certificate
Dim cert As New Certificate
cert.Load "c:\mbx\joe.pfx"
'and encrypt the message
Smtp1.Message.Encrypt cert
' optionally, save the message
Smtp1.Message.Save App.Path & "\encrypted.eml"
above code will create new message and encrypt it using certificate stored in PFX file.
wodSmtp can also use certificates stored in Windows certificate store, so this code can also be used to encrypt the message:
Dim cert As New CertLocation
Smtp1.Message.Encrypt cert(CurrentUser).Item("AddressBook").Item("John Doe")
Smtp1.Message.Encrypt cert(CurrentUser).Item("AddressBook").Item("John Doe")