Visual Basic Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
Bzip2
PPMD
Deflate
LZW


VB Strings
VB Byte Array

 

 

 

 

 

 

 

Creating and Saving S/MIME Email to .EML File

Download Chilkat Email ActiveX

Demonstrates how to create a digitally signed email and save it to a .eml file.

    Dim ccs As New ChilkatCreateCS
    
    ' Find the certificate that we will use to sign the email.
    Dim certStore As ChilkatCertStore
    Set certStore = ccs.OpenCurrentUserStore()
    Dim cert As ChilkatCert
    Set cert = certStore.FindCertBySubjectE("matt@chilkatsoft.com")

    ' We could've loaded the certificate from a DER encoded X.509 .cer file.
    'Set cert = New ChilkatCert
    'cert.LoadFromFile "matt.cer"

    ' Create a mailman object.
    Dim mailman As New ChilkatMailMan2
    mailman.UnlockComponent "anything for 30-day trial"
    
    ' Create an email object.
    Dim email As New ChilkatEmail2
    
    ' Assign the cert to the email so that it is used when signing the email.
    email.SetSigningCert cert
    
    email.AddTo "Email Programming Expert", "support@chilkatsoft.com"
    email.Subject = "This is the subject"
    email.Body = "Send your example requests to support@chilkatsoft.com"
    email.From = "matt@chilkatsoft.com"
    
    ' Indicate that the email should be sent digitally signed.
    ' When sending a signed email, the private key is used, so the private key
    ' associated with the chosen certificate must be installed on the system.
    email.SendSigned = 1
    
    ' You can create S/MIME with a detached signature (the default), or you can
    ' set OpaqueSigning = 1 for an opaque signature.
    mailman.OpaqueSigning = 1
    
    ' The RenderToMime method renders the email according to the property settings.
    ' In this case, SendSigned = 1, so the rendered MIME will be an S/MIME message.
    smime = mailman.RenderToMime(email)
    If Len(smime) = 0 Then
        MsgBox mailman.LastErrorText
    End If
    
    ' Write this string to a .eml file
    Open "signedEmail.eml" For Output As #1
    Print #1, smime
    Close #1

 

© 2000-2012 Chilkat Software, Inc. All Rights Reserved.