Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcel

SQL Server Examples


ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
ECC
Email Object
Encryption
FTP
Facebook
Firebase
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)

Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
VoiceBase
Walmart
WebSocket
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(SQL Server) Parsing a Multipart/Digest Email

This example demonstrates how to parse a multipart/digest email. An email parsed by this sample could have a MIME structure as follows:

multipart/mixed
    text/plain
    text/plain
    multipart/digest
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
        message/rfc822
    text/plain

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @sTmp1 nvarchar(4000)
    --  Note: This example requires Chilkat v9.5.0.66 or greater.

    DECLARE @emlPath nvarchar(4000)
    SELECT @emlPath = 'qa_data/eml/multipart_digest.eml'

    DECLARE @email int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Email', @email OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    --  For this example, we'll load the email from a .eml.
    --  The email could alternatively be loaded as a result of downloading from an IMAP or POP3 server..

    DECLARE @success int
    EXEC sp_OAMethod @email, 'LoadEml', @success OUT, @emlPath
    IF STR(@success) <> 1
      BEGIN
        EXEC sp_OAGetProperty @email, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @email
        RETURN
      END

    DECLARE @numDigests int
    EXEC sp_OAGetProperty @email, 'NumDigests', @numDigests OUT

    PRINT 'num digests = ' + STR(@numDigests)

    DECLARE @i int
    SELECT @i = 0
    WHILE STR(@i) < STR(@numDigests)
      BEGIN
        DECLARE @eDigest int
        EXEC sp_OAMethod @email, 'GetDigest', @eDigest OUT, STR(@i)

        EXEC sp_OAGetProperty @eDigest, 'FromAddress', @sTmp0 OUT

        EXEC sp_OAGetProperty @eDigest, 'Subject', @sTmp1 OUT
        PRINT STR(@i) + ':' + @sTmp0 + ', ' + @sTmp1
        DECLARE @m nvarchar(4000)
        EXEC sp_OAMethod @eDigest, 'GetHeaderField', @m OUT, 'Message'
        EXEC sp_OAGetProperty @eDigest, 'LastMethodSuccess', @iTmp0 OUT
        IF @iTmp0 = 1
          BEGIN

            PRINT '    Message = ' + @m
          END
        EXEC @hr = sp_OADestroy @eDigest

        SELECT @i = STR(@i) + 1
      END

    EXEC @hr = sp_OADestroy @email


END
GO

 

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