Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

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

More Examples...
Email Object
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA


VB Strings
VB Byte Array

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

 

Send a Digitally Signed Email

Download Chilkat Email ActiveX

This example source code sends a digitally signed email. It automatically finds and selects the digital certificate based on the From email address. This is the quickest and easiest way to send a digitally signed email. This program should work if you already have Outlook configured and are able to send signed mail from Outlook.

' VB example program to send a digitally signed email.
Private Sub Command1_Click()

    ' Create the mailman object for sending mail.
    Dim mailman As ChilkatMailMan2
    
    Set mailman = New ChilkatMailMan2
    
    ' Pass any string to begin the 30-day trial.
    mailman.UnlockComponent "UnlockCode"

    ' Set our SMTP server to be used for sending signed mail.
    mailman.SmtpHost = "smtp.earthlink.net"
    
    ' Only set username/password if your SMTP server requires a logon.
    'mailman.SmtpUsername = "your_username"
    'mailman.SmtpPassword = "your_password"
    ' Only set the login domain if your SMTP server uses integrated Windows authorization
    ' AND it is part of a domain.
    'mailman.SmtpLoginDomain = "your_domain"
    
    ' Create the mail object.
    Dim email As ChilkatEmail2
    Set email = New ChilkatEmail2
    
    email.AddTo "Email Expert", "support@chilkatsoft.com"
    email.Subject = "This is the subject"
    email.Body = "This is the body"
    email.From = "matt@chilkatsoft.com"
    
    ' To send encrypted and/or signed emails, just set either or both of these flags.
    ' Chilkat Mail will automatically find the certificates based on the From / To
    ' email addresses.  For signing, the certificate matching the From email address
    ' is used.  For encryption, the certificate matching the To email address is used.
    ' 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.
    ' In general, if you have Outlook setup correctly and you are able to send
    ' signed emails using Outlook, this should work.  Sending a signed email is
    ' nothing more than setting the SendSigned property to 1.
    email.SendSigned = 1
    'email.SendEncrypted = 1
    
    ' Send mail.  Returns 1 for success, 0 for failure
    Dim success As Long
    success = mailman.SendEmail(email)
    
    If (success = 0) Then
        MsgBox mailman.LastErrorText
    Else
        MsgBox "Digitally Signed Email Sent!"
    End If
    
            
End Sub



 

Need a specific example? Send a request to support@chilkatsoft.com

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