Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

SQL Server Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
FileAccess
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
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)
Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(SQL Server) Add Base64 Image to HTML Email

Demonstrates how to add an image "file" where the binary data for the image is in base64 string form.

Note: This example requires Chilkat v9.5.0.65 or greater.

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)
    --  Note: This example requires Chilkat v9.5.0.65 or greater.

    --  This example requires the Chilkat Email API to have been previously unlocked.
    --  See Unlock Chilkat MailMan for sample code.

    --  The mailman object is used for sending and receiving email.
    DECLARE @mailman int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.MailMan', @mailman OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    EXEC sp_OASetProperty @mailman, 'SmtpHost', 'outlook.office365.com'
    EXEC sp_OASetProperty @mailman, 'SmtpPort', 587
    EXEC sp_OASetProperty @mailman, 'StartTLS', 1

    --  Set the SMTP login/password
    EXEC sp_OASetProperty @mailman, 'SmtpUsername', 'OFFICE365-SMTP-LOGIN'
    EXEC sp_OASetProperty @mailman, 'SmtpPassword', 'OFFICE365-SMTP-PASSWORD'

    --  Create a new email object
    DECLARE @email int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Email', @email OUT

    EXEC sp_OASetProperty @email, 'Subject', 'Testing for Chilkat API...'
    EXEC sp_OASetProperty @email, 'Body', 'Testing for Chilkat API...'
    EXEC sp_OASetProperty @email, 'From', 'Chilkat Support <my-office365-user@mydomain.com>'
    EXEC sp_OAMethod @email, 'AddTo', @success OUT, 'Chilkat Support', 'support@chilkatsoft.com'

    --  Load Base64 image data into a StringBuilder.
    DECLARE @sb int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sb OUT

    DECLARE @bCrlf int
    SELECT @bCrlf = 1
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '/9j/4AAQSkZJRgABAgEASABIAAD/7Q18UGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'AQBIAAAAAQABOEJJTQPzAAAAAAAIAAAAAAAAAAE4QklNBAoAAAAAAAEAADhCSU0nEAAAAAAACgAB', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'AAAAAAAAAAI4QklNA/UAAAAAAEgAL2ZmAAEAbGZmAAYAAAAAAAEAL2ZmAAEAoZmaAAYAAAAAAAEA', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'MgAAAAEAWgAAAAYAAAAAAAEANQAAAAEALQAAAAYAAAAAAAE4QklNBBQAAAAAAAQAAAABOEJJTQQM', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'AAAAAAyTAAAAAQAAAIAAAACAAAABgAAAwAAAAAx3ABgAAf/Y/+AAEEpGSUYAAQIBAEgASAAA//4A', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'J0ZpbGUgd3JpdHRlbiBieSBBZG9iZSBQaG90b3Nob3CoIDQuMAD/7gAOQWRvYmUAZIAAAAAB/9sA', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'hAAMCAgICQgMCQkMEQsKCxEVDwwMDxUYExMVExMYEQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwM', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'DAwMDAwMDAwMAQ0LCw0ODRAODhAUDg4OFBQODg4OFBEMDAwMDBERDAwMDAwMEQwMDAwMDAwMDAwM', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'DAwMDAwMDAwMDAwMDAwMDAz/wAARCACAAIADASIAAhEBAxEB/90ABAAI/8QBPwAAAQUBAQEBAQEA', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'AAAAAAAAAwABAgQFBgcICQoLAQABBQEBAQEBAQAAAAAAAAABAAIDBAUGBwgJCgsQAAEEAQMCBAIF', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'BwYIBQMMMwEAAhEDBCESMQVBUWETInGBMgYUkaGxQiMkFVLBYjM0coLRQwclklPw4fFjczUWorKD', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'JkSTVGRFwqN0NhfSVeJl8rOEw9N14/NGJ5SkhbSVxNTk9KW1xdXl9VZmdoaWprbG1ub2N0dXZ3eH', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'l6e3x9fn9xEAAgIBAgQEAwQFBgcHBgU1AQACEQMhMRIEQVFhcSITBTKBkRShsUIjwVLR8DMkYuFy', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'gpJDUxVjczTxJQYWorKDByY1wtJEk1SjF2RFVTZ0ZeLys4TD03Xj80aUpIW0lcTU5PSltcXV5fVW', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'ZnaGlqa2xtbm9ic3R1dnd4eXp7fH/9oADAMBAAIRAxEAPwD1VJJJJSkkkklKSSSSUpJJMSACTwEl', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'KJA5MJAg8arnuqdbta4+hJaCQ0AgTHfe8tY3/OUuh9bsybfRu0d2Ez/0x7Xf2FWhzuGeY4Ym5DTw', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'sM8uWyDH7h27dXoEkklZYFJJJJKUkkkkp//Q9VSSSSUpJJJJSkkkklKVPqt5pxHR9J/tbHmriw/r', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'Dk/QpaYI9x+P5qh5nKMWHJP92Jrz6MuCHHkiPG3l+oZTq2uL7HUkHYwCptnOm24n6KX1eut/aoBe', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'XxtklpbyN3tb9Db/AFULMIcNG2XO3S9oY6IHtJ9R7n1+p7vzq0X6sML+pudtexu/2tsMuho2rE+H', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'C8sD1uyaH/o7rZ6GDJ5PobfohOmHATroXEUkkkkpSSSSSn//0fVCsLq/XjiZLcZhDXuMCSAfj7y1', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'bq5D64dLvLvtmO3c5oOkSdR+bq3a5Qc17vtH2jwy7s/KjGcoGTY925T1zKkS9rpbvhwj2n6Lv7Sv', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '4/XGED127Afzxq371weL1S5zrWhj3MrAFr3CXNaxrf0TI2saz1HfSWvh5rb9rK3erLQHMA9rCfe2', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'v+Vbt+msSPxHnMB/WEZIj5rHqr+9H/um/k5PGRtXjF7aq6q1u6twcD4Ii5inJvx9a7SNfonVv9VX', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'cfrpiL2THLma/gtPl/inK5q9fBL92fpaM+VmPl9Q/F1ci0U0vsPDRK5fLyK773vtkh57dgPo8q91', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'XrNVtPpUgw76RIgx5LA9V9hcGAuOob8fzdPcqfxfmY5IjDjleolMxOn9UW2uU5cxBlIEE/k0utua', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '3I9+zbUyGNb7HTz7y0v9Rn9lXvqcA/KDh3kmPM/Bv0formus32G5zGEEuJ95c50iezrfc3/MXR/U', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'UPrewXRLgdseEo/DsfDLFZ1/sZ+ZFcvPfSnv0kkltOMpJJJJSkkkklP/0vVUO6llzCx4kFESSU8X', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '136py512NInnZoY52rmrKMzBtLLA5nIN7Xlpj2hrH7o2+xm32r1d7GvEOEgrE6z9XcfMrc5jQHdx', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '2Kp8xycZgmIqXb9FvctzpiRHJrHa+oeTxeqtftpvHpMaJNz/AHHafosayvd/J/tq4CHNL2n2nVjj', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'I9vDbPd9Dcuc6xjZvTb4IOpAaXRtEHdt2EbHf2kbp3WXwK8j3DvHgJj2AfvO/wAG1lCxc3JmIJAo', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'jeLpcIIEomwfsdi/JsgEHQATI1IHzSos3te4MdZtG4tYDr3hw9yrXX45x22eo173uLRWPpCAJds/', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'd/roTMvJraTjv9PcC1xAB077tzVAMZI2rXrouoGB4Rr9jWLK78mCC93mZgRH8natrArOPXW5jxWG', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'mWieD+c7+0szExwLw+ZeQNw8PLn/AKpaFtwrYxrwQXOIZIEODf3fpJ+TJMSj7ZIMdkTAPpNa7vQ0', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '9Zy3e1r2PA/Ogop6vmt59P46hczj9VxWOIdc2pokS4gcCZhhf/I/tqX7axrAG1WG2xztuxrSZb++', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '0/2fannn/iIOktO/A1DyuO/lFPQP6vknT1mM54CA7rFokuySI8uQBJhczd9YGOgVVOLmtLnkkREt', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '52B3s2uQLer5GYHMqqZU120AjVzSwS57f5FzvZtTvf8AiEj6spiPDgDJHlYV8o/B7PD68/ewWPD2', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'P4n2nXwat6qwW1h7eHCVwXQun5uVktssc5wB1n6I13RW36LV3WLWaqGsPYLb5L3/AGv154pXodjw', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '+Lnc3HHHJWP60//T9VSSSSUpJJJJTgfWjp1F+N6jmAmYOnK4h/TGh72tgGSABIAE/wDSXc/WHNZs', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '9Bp+iZcQJ17NH8pcwGF1zng7Q7gGJ/L/ANBYfxPMBnqB1EfV/edjkOKOL1bbhzh030w4xu2e48wJ', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '/O/8yQ22lr3V7y1oBHpiCD9E7t+r/wAz6CXU+qOYLK8Z+3e3ZZug6D3Q3/yay8LPd9oHqDdBH0oM', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '/wBoqHHjySgZy7aNq7oV5Olffk4k+i80u2ncQNYP0v3lj35ORkWbrHl7hI3ET/J/zdrVu5TmZlTL', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '9jKKwzZIfJd+dudvj81Zd2CxoNlT5AE7VJglAfMAJ7fyLLHhIsj1bIcejIyDsbuId9LUCCPzv+i1', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'amF0q/6ALnE6ECXeP9lav1Y+rzspoc46GC93czrtXZYPQMPGaPYC7uSruPlJZBczwwOwju0OY5+O', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'MmGMXIdS8ng/VXIs19PZuOrnan/N+it3B+qdVcG47o1jgfcuhZVWwQ1oCmrePl8UPliL7nUudk5r', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'Nk3ka7DRDj4tOO0NraAjJJKZgf/U9VSSSSUpUep9QGLUQ0j1HDTyH7ysZeSzGpdY7twPErk+sZ7r', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'XEl3ueYFY5AiW/yf6yp89zYwYzR/WS0hH/uv7sWzyuD3JgkegbtbMyCbHOfOwH3WHVuv5ztqw+qd', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'QaJqoeLNdXsJESNGsn876W+x6XUuqEOfjU2tdXYBudGojmuHbttjbP8ArarYvTH5Lm2aw4mAPzvu', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'WLgwyMuOdylI2B1lI9ZOvQiLPpjFzhXbaToXAz7RMD86ByojHcy4BzS0ke3dp/mrvelfU/cxrrQG', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'DwHP+cm659UmV0i6rU16ydSP/MVqHl8ogZabfL1YYc9hOQQ6X8zzuDS9+K4NDhZHt2l4G7R30Wex', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'u2trv9J/pE7Mewyx7RLjqXGfJ/u/R/nfvI7AcctayQ0aEbiw6iHe+fzm+z/CIx2mH7RUzgAkuJJ+', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'lte8O3/yvYsqWQ2a67NiRPFpsdXqvqltGK5o0IK6Fct9V8lovfU2QHAGDprx2XUroeVnx4Mcu8Q4', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'fMxMc0we9/apJJJTMKkkkklP/9X1VJJJJTg/WDL9N4b2rbuDfFx9rWrj+pZz3l9TGA2Wa+0maxxZ', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'Xc2N2y5i7Dr+BkXO9SkTMdgdRx9JYVH1bzL8h1j27C7RzjyR8Fj81yebLzcp8NxoCBJ9IdTlc+DH', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'hHEfV2cvpnR/tFrRVSGv0BP0tp4+m73dv5tdn0foFWM0W3DdaYklWel9GowWCBL+5PK0gABAWjg5', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'aGId59ZHUtTmeanlJANQ6RUAAIGgUbqm21mtwkOEKaSnaz599YemvwLXFodssPLfDt3/AHlm13Wv', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'q2uyQKqBpU5xBl30m1j8937y77r/AE1mZiOO2XtEhcDl4hqyTU6sNbWR+l+iAJO83aP3/urG5/lh', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'CfEBUJG77Sdrks/u4xE6zi63Qsl1WWx5na5x2vmQ4E7XO3fn+9q7ml4fU1w7heZ4mQWXs2WizHrP', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'pVFkBu4fpHbW/S/tr0Hot/r4NbjyBCs/DJ/qjA/ok1/dk1PiOOpif72jfSSSWg0FJJJJKf/W9VSS', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'SSUsQDykABwE6SSlJJJJKUkkkkpYgEEHgrl/rR0IZDTdW2e5A8V1KhZUy1pa8SCmZMcckTGWxZMW', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'WWOYnHcPllOPkDN3GrYWwJa0BsTxXt9jPo+5egfVxj24DdwgnX70x+ruGbfUAgTO3stLHoZRWK2C', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'AFDy3LeyZG7vQf3Wfmub94RFVSVJJJWWopJJJJT/AP/ZADhCSU0EBgAAAAAABwABAQEAAQEA//4A', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'J0ZpbGUgd3JpdHRlbiBieSBBZG9iZSBQaG90b3Nob3CoIDQuMAD/7gAhQWRvYmUAZIAAAAABAwAQ', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'AwIDBgAAAAAAAAAAAAAAAP/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwR', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwR', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'EQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8IAEQgAeAB4AwEiAAIRAQMRAf/E', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'AMkAAQACAgMBAAAAAAAAAAAAAAAFBgQHAQMIAgEBAAMBAQEAAAAAAAAAAAAAAAMEBQIBBhAAAgIB', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'BAICAgIDAAAAAAAAAgMBBAUAIBEGEBITFDAhMSJBIxURAAIBAwEEBwMJBQkAAAAAAAECEQASAyEx', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'IjITIEFRQlJiBGFyIxAwcYGRoZJDY8GCotIz8LGywuJTc4MUEgABAwEGAwQIBwEAAAAAAAABABEC', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'IRAgMVEiA0FxEmEyQmKBkaFScpLS4sHRgrITIzME/9oADAMBAQIRAxEAAADaoAABG89SPNDu0Mvc', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'LEAAA4OXHIBxTbXRsu/BbL1ltLvvOGjmgAcUW91SvZw5bXsziaWwMmk996jI1tHZ1/B2zqDa+xUk', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'Xxxez+xjffnvcPeXHIgKJtrCr2tWy8Ri42xLdPSikz5CDj/OLz8U9zxacSJuFyCzu1u430AYPPVe', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'rudAfO73XkV7MsSfPxLSUjJs8796eDj9/KWEADppktR8XW68KQv8slOitxVSxXqcjGdmRobU+sHO', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '+k+eB4ABTojYytaj5Is1XX2DWkZsjWePuX6yU25aeUEsAB5VHqp5VHqp5VHqp5VHqmN80POvTub5', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'VPPVTyq989VPKo//2gAIAQIAAQUA8sMVhVtBYHdl3QKsYPA+bajYuH3K0ozKiG02LVmiQRrnXMeX', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '1gbFirEEK/WfrOOYqvjVTGlB+DIQFrCtPJECtBSZLQsNmReTW1KnMWqv+pRSDY/ez6Sfk8XK0ide', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'ZlO4vXiOOPH/2gAIAQMAAQUA8gEmT65Jndjw/tkpj1802ADG1lnB0C0mv8a8iJa4nUgUR4rXDVIT', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'BRP7k4idQnT3oWP+dCMkSBlSogplzvRbbTmT5oV+BtWxVqpeOWGv2GY4nzF5ormZmdUrEMXbiIfu', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'D25nnnx//9oACAEBAAEFAPwew8/lzGRmquM1cVaqPixX/J2C2bLVpwm/r0zON3SQxqCGdl+xFepa', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'hhHJE+zhQ9Mftn+M1m3ryNbJTqpn2jFXJVLUa7HdESvXAmnUeDb+PH1qbu29c+4K2uptoZdJS2zE', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'aTnbYauWHWGZb1+thKRBaxOQrvqQ1c6J6R0WSojKrVdvmYgozXV614L+It4tlHLwBG4SA/6MyloT', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'jFLGFpsLnUur8E8PR+TUoK2fg20mE2t5yOMr3k9j62yhcrvuVYZZc94mEQ7M0q6f++2dB2DJNM/t', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'WWU8JZeeD6n8JgEAOzt0gxykhI5HIUxmnCLCbddxaqVSe/E9SsOCn1KmnSKNZEbcnkBqKuuhx5bK', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'cDY+R441hg2wTId1iks8ksBAN1qyusnJXnut3cpMxXxdmyaejvagMW6nYH4nBiiivbWUEG7sF2Pm', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'yVkDLGYQ3vwvXU0xgRiO2YaShdo1tSUrZh7EWKG7stOx8+O6zcsHisNXoK8OUDl9hxcY+4E2Vq6d', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'chtbcSwPQgA7ewYqL1W/UOq3o4lE/k/nV/A07hY7GIoBs//aAAgBAgIGPwC0zkWjEOSjKIIYsxvx', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '2+O4ajyxUuGFxoSMSK6Sy0zluRGMZ6/uX9sTtns1xQnXpDCHKP1KcImoazG3KWf5qhAmMYoSNSMu', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '78yMx1QyL9Cae9L55yQm8gxfr7ptMpFoxDklSlAMCafCEGNRVR2zTqyWmIfPxeu4f+aNIQ/0LPqy', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '/SnGmHveOf2onb7w9qhL3SD6PFdluEEmRcg923qA0TrnX3fKoE49Iv6mbtVLf//aAAgBAwIGPwC0', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'RGJQ6qvflM4CgW2OdzWKGj5J2enDFPA08yjE48fiW3JqMVgnII9FrHVDL6UJwqCHUXoQMEXdP7UQ', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '4nI8B+NojEOShB6o+sFSmA/SHWqR5CgufyEPKWCYatz9vNdO4aTpyU45gog8Lg24sGo/FObBGR1x', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'pzC3AMHv6Hfyovj22//aAAgBAQEGPwD5iJE/PDGhjI+w9g62oPduTPWWMnTmT8NbvI+SkyjvCfnc', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'jI9gU2AhgG08K/56S3nqA4XEMuRcgjW98X6d3hrFPYOnqYrQg9DJlPUNPppmGPmlZLglgI2tdyRd', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'WMh8bKXLtaGZg0cHOyDmbs9+sQ8o6Rp8OQsMaST/AHJbvL3vLV+HMwUNy0dWlWYf1GVX7qV8SM+M', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'EjmJt09n8tTiyCfCdvyJ6eZA3iO090VkUlr2FqnCGDa+bDwf9lLiXuC0bJgmfeu4e/WMeUdP/wBW', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'ARlTUEATRPrXJzl7QGHw2VmL5N78v8FXernHmyERittUSLt2eHEiMlBoMwCrAQYiZSN+2hjTMTI0', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'vE/Y01eWuZiC3b7K0JYnQE3bFEKiLr47t9P+OudkW1wCVY7J9vvW0kOAwEMp0INcQ+2t51H11BzL', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '9tfDyK30H5YOoNMyAK5BB7DNOGL2bSZmFHhuVrt2jj9QxJymTlyTzIU/lXMuPH+/ZZQyKYB6/qDW', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'KG/x9+pgAdZjs0mkGDM2ZgoBQqVtPZ+pQL7zRNmzZ2W0FCqOxpYnX8NaSIAJMkftosMYcCNpJ2nc', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '28VcycVrYzlRJAJVTvKnDv8A6dKMQLZCf6iC1QSLtp38n+3SO/EQJ6BTIonqNO6kBDqZ+nu0oEk7', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'bSNDrB2/E/jpvUeoCoGMwBuqBpwLP8PxHoPi4XWbmlTDCWmaAxl3zWExwKrEW7d+/Z4KW0ajaCWK', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'yRBlBb37P56YXlAV5cqoAtA3f323LnqFL8kEFpc7FjrNqe5bW6pyGQV00FpuXebzeFaXN6gajULQ', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'UbB0SE1ZFknqBmdaus1I6xB++sePFdzQPiHQANO7y7eKnfLnXG4UxeSCSusDxXUHVSVA2ChjgmOI', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'n/TxUpCcpBEE6t9OtBso5jDrbWoxoBHShdcraKv7aZ3N4BkxvTPft8VN6dLTrDEGT+pjDqOLz1La', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '9Z9hrGCV013xuj32Ph81WubCwDRI0u3wODC7W8FC6CrtIgEDQeb3qCqIAHTbK5gKKAMczJsUkag3', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'WKt1cv0gbDkAZMzg9v5ZXuuv9slC4asdAokkezh/HRdse3UAnWmTJIOIm07GOumzeoMTvqbQqqdZ', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '3p5jO2Ld4Fx46xZCAhVgCp0MHTZanepWHWOmULEY8IEkam5uGhhV2TI+nqJUl8ZU22RI3H4r1oW3', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'ZspOpYkgeZot73coZMouynUk1AGlH1WAQTx6ffWS3Eucxaqm7dYm1SIbxdykXIvLeTxgghjs5hea', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'xOPCJ6bsuO9Wa7YT1W+7u+apZWUE65H1eNkXUFVRd1n5WxuJDCKZwrQzAqykgrJjmLHEyrQyJ8R8', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, '5tW83ZNt7uMQZrMlqb7U2ObgDIP069PeANboA6JKj4iiVNOro3NZiOdLXmfyr7iqL+pTaQoAEDQf', @bCrlf
    EXEC sp_OAMethod @sb, 'AppendLine', @success OUT, 'f5fnr2W1+0aGrcQ+vo//2Q==', @bCrlf

    --  Decode to a BinData.
    DECLARE @imageData int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.BinData', @imageData OUT

    EXEC sp_OAMethod @sb, 'GetAsString', @sTmp0 OUT
    EXEC sp_OAMethod @imageData, 'AppendEncoded', @success OUT, @sTmp0, 'base64'

    DECLARE @contentIdStarfish nvarchar(4000)
    EXEC sp_OAMethod @email, 'AddRelatedBd', @contentIdStarfish OUT, 'images/starfish.jpg', @imageData
    EXEC sp_OAGetProperty @email, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 <> 1
      BEGIN
        EXEC sp_OAGetProperty @email, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @mailman
        EXEC @hr = sp_OADestroy @email
        EXEC @hr = sp_OADestroy @sb
        EXEC @hr = sp_OADestroy @imageData
        RETURN
      END

    --  The src attribute for the image tag is set to the contentIdStarfish:
    DECLARE @sbHtml int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbHtml OUT

    EXEC sp_OAMethod @sbHtml, 'Append', @success OUT, '<html><body><p>This is an HTML email with an embedded image.</p>'
    EXEC sp_OAMethod @sbHtml, 'Append', @success OUT, '<p><img src="cid:CONTENT_ID_STARFISH" /></p></body></html>'
    DECLARE @numReplacements int
    EXEC sp_OAMethod @sbHtml, 'Replace', @numReplacements OUT, 'CONTENT_ID_STARFISH', @contentIdStarfish

    EXEC sp_OAMethod @sbHtml, 'GetAsString', @sTmp0 OUT
    EXEC sp_OAMethod @email, 'SetHtmlBody', NULL, @sTmp0

    DECLARE @success int
    EXEC sp_OAMethod @mailman, 'SendEmail', @success OUT, @email
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @mailman, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
      END
    ELSE
      BEGIN

        PRINT 'Mail Sent!'
      END

    EXEC @hr = sp_OADestroy @mailman
    EXEC @hr = sp_OADestroy @email
    EXEC @hr = sp_OADestroy @sb
    EXEC @hr = sp_OADestroy @imageData
    EXEC @hr = sp_OADestroy @sbHtml


END
GO

 

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