Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
Access Attached Message (Embedded Email)How to access an email embedded within another email (i.e. an attached message).
CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @sTmp0 nvarchar(4000) DECLARE @email int EXEC @hr = sp_OACreate 'Chilkat.Email2', @email OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- Load an email from a .eml DECLARE @success int EXEC sp_OAMethod @email, 'LoadEml', @success OUT, 'embeddedEmail.eml' IF @success <> 1 BEGIN EXEC sp_OAGetProperty @email, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END -- Display how many attached emails are embedded within -- this one: DECLARE @numAttached int EXEC sp_OAGetProperty @email, 'NumAttachedMessages', @numAttached OUT PRINT @numAttached -- Get the 1st attached message. DECLARE @email2 int EXEC sp_OAMethod @email, 'GetAttachedMessage', @email2 OUT, 0 IF Not (@email2 Is NULL ) BEGIN -- Display the subject, From, and a header field... EXEC sp_OAGetProperty @email2, 'Subject', @sTmp0 OUT PRINT @sTmp0 EXEC sp_OAGetProperty @email2, 'From', @sTmp0 OUT PRINT @sTmp0 EXEC sp_OAMethod @email2, 'GetHeaderField', @sTmp0 OUT, 'X-SOMETHING' PRINT @sTmp0 END END GO |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.