VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++DelphiFoxProJavaPerlPythonRubySQL ServerVBScript

Visual FoxPro Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Byte Array

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

Non-Chilkat Links
Text and String Handling

Send Already-Signed MIME w/ SendMime

Demonstrates how to use SendMime to send an already-signed MIME message.

Download Chilkat Email ActiveX

Download Chilkat IMAP ActiveX

LOCAL loMailman
LOCAL lnSuccess
LOCAL loEmail
LOCAL loCertStore
LOCAL loCert
LOCAL lcSignedMime
LOCAL lcFromAddr
LOCAL lcRecipients

*  The mailman object is used for sending and receiving email.
loMailman = CreateObject('Chilkat.MailMan2')

*  Any string argument automatically begins the 30-day trial.

lnSuccess = loMailman.UnlockComponent("30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX("Component unlock failed")
    QUIT
ENDIF

*  Set the SMTP server.
loMailman.SmtpHost = "smtp.chilkatsoft.com"

*  Create a new email object
loEmail = CreateObject('Chilkat.Email2')

loEmail.Subject = "This email is signed"
loEmail.Body = "This is a digitally signed mail"
loEmail.From = "Chilkat Admin <admin@chilkatsoft.com>"
loEmail.AddTo("Chilkat Support","support@chilkatsoft.com")

*  Indicate that the email should be sent signed.
loEmail.SendSigned = 1

*  Create an instance of a certificate store object, load a PFX file,
*  locate the certificate we need, and use it for signing.
*  (a PFX file may contain more than one certificate.)
loCertStore = CreateObject('Chilkat.CertStore')
*  The 1st argument is the filename, the 2nd arg is the
*  PFX file's password:
lnSuccess = loCertStore.LoadPfxFile("chilkat.pfx","myPassword")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loCertStore.LastErrorText)
    QUIT
ENDIF

loCert = loCertStore.FindCertBySubject("Chilkat Software, Inc.")
IF (loCert = NULL ) THEN
    =MESSAGEBOX(loCertStore.LastErrorText)
    QUIT
ENDIF

*  This example will use the cert from the certStore...
loEmail.SetSigningCert(loCert)

*  Render the email to signed-MIME.  This is where the private
*  key is accessed and the signing happens.

lcSignedMime = loMailman.RenderToMime(loEmail)

*  Now send the already-signed MIME:

lcFromAddr = "admin@chilkatsoft.com"
lcRecipients = "support@chilkatsoft.com, matt@chilkatsoft.com"
lnSuccess = loMailman.SendMime(lcFromAddr,lcRecipients,lcSignedMime)
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loMailman.LastErrorText)
ELSE
    *  The LastErrorText property provides information
    *  even when successful.
    =MESSAGEBOX(loMailman.LastErrorText)
    =MESSAGEBOX("Mail Sent!")
ENDIF

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

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

Mail Component · .NET Email Component · ASP Mail Component · XML Parser