SQL Server Stored Procedure Examples

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

SQL Server
Stored Procedure Examples

Quick Start
Encryption
File Access
IMAP
POP3
SMTP
Email Object
DKIM / DomainKey
FTP
HTML Conversion
HTTP
MHT
MIME
NTLM
RSA
Diffie-Hellman
DSA
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
String
Tar
Upload
XML
XMP
Zip

Amazon S3
Bz2
CSV
FileAccess
Byte Array
RSS
Atom
Self-Extractor

Yahoo! IMAP (imap.mail.yahoo.com)

(from Wikipedia)

It is possible to get direct IMAP access without signing up for paid access nor using software like YPOPs! or FreePOPs. Yahoo! operates IMAP and secure IMAP servers (imap.mail.yahoo.com in particular), which are globally accessible. However they require a specific, non-standard IMAP command to be sent before login is done, namely: “ID ("GUID" "1")”.
This example demonstrates sending the non-standard IMAP command after connecting but before login.

Download 32-bit Chilkat IMAP ActiveX (.msi)

Download All 32-bit Chilkat ActiveX Components (.zip)

Download All 64-bit Chilkat ActiveX Components (.zip)

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @imap int
    EXEC @hr = sp_OACreate 'Chilkat.Imap', @imap OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    --  Anything unlocks the component and begins a fully-functional 30-day trial.
    EXEC sp_OAMethod @imap, 'UnlockComponent', @success OUT, 'Anything for 30-day trial'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @imap, 'LastErrorText', @sTmp0 OUT

        PRINT @sTmp0
        RETURN
      END

    --  Connect to they Yahoo! IMAP server.
    EXEC sp_OAMethod @imap, 'Connect', @success OUT, 'imap.mail.yahoo.com'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @imap, 'LastErrorText', @sTmp0 OUT

        PRINT @sTmp0
        RETURN
      END

    --  Send the non-standard ID command...
    DECLARE @rawResponse nvarchar(4000)

    EXEC sp_OAMethod @imap, 'SendRawCommand', @rawResponse OUT, 'ID ("GUID" "1")'
    IF @rawResponse Is NULL 
      BEGIN
        EXEC sp_OAGetProperty @imap, 'LastErrorText', @sTmp0 OUT

        PRINT @sTmp0
        RETURN
      END

    --  Login
    EXEC sp_OAMethod @imap, 'Login', @success OUT, 'myLogin', 'myPassword'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @imap, 'LastErrorText', @sTmp0 OUT

        PRINT @sTmp0
        RETURN
      END


    PRINT 'Login Success!'

    --  Select an IMAP mailbox
    EXEC sp_OAMethod @imap, 'SelectMailbox', @success OUT, 'Inbox'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @imap, 'LastErrorText', @sTmp0 OUT

        PRINT @sTmp0
        RETURN
      END

    --  Continue with whatever you wish to do...
    --  (see other examples..)

    --  Disconnect from the IMAP server.
    EXEC sp_OAMethod @imap, 'Disconnect', NULL

END
GO

 

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