Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Upload (Append) Email to an IMAP MailboxUpload / append an email to an IMAP mailbox.
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 an IMAP server. EXEC sp_OAMethod @imap, 'Connect', @success OUT, 'mail.chilkatsoft.com' IF @success <> 1 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 DECLARE @email int EXEC @hr = sp_OACreate 'Chilkat.Email2', @email OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- Load the email from a .eml file. EXEC sp_OAMethod @email, 'LoadEml', @success OUT, 'myEmail.eml' IF @success <> 1 BEGIN EXEC sp_OAGetProperty @email, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END EXEC sp_OAMethod @imap, 'AppendMail', @success OUT, 'Inbox', @email IF @success <> 1 BEGIN EXEC sp_OAGetProperty @imap, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END PRINT 'Email uploaded to Inbox!' -- Disconnect from the IMAP server. EXEC sp_OAMethod @imap, 'Disconnect', NULL END GO |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.