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
Attached Email Messages (message/rfc822)
This article discusses the topic of attached email messages. An email may contain one or more embedded emails, each of which can be extracted using the Chilkat mail component API. Attached messages typically occur in forwarded emails. ' Attached messages are complete emails embedded within another email. ' The Chilkat email component provides methods and properties for ' accessing attached messages. This example demonstrates how to ' retrieve each attached email message and save each to a file. Private Sub SaveAttachedMessages(email As ChilkatEmail2) Dim attEmail As ChilkatEmail2 Dim filename As String fnameIdx = 0 n = email.NumAttachedMessages For i = 0 To n - 1 Set attEmail = email.GetAttachedMessage(i) ' Get the filename for this attached message ' (This may or may not be present, or you may decide not to use ' the embedded filename anyway...) filename = email.GetAttachedMessageFilename(i) If (Len(filename) = 0) Then fnameIdx = fnameIdx + 1 filename = "email_" + Str(fnameIdx) + ".eml" End If ' Save to a .eml file. attEmail.SaveEml filename ' NOTE 1: Each attached message may itself contain other attached messages... ' NOTE 2: File attachments within an attached message are not included in the ' attachments for the outer email. Next End Sub
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.