Classic ASP Requires Chilkat v11.0.0+
Classic ASP
Read an attached email
See more Email Object Examples
Open forward-as-attachment.eml from the forwarding example. Read the cover note’s subject, then open each attached message and inspect its own headers and attachment count. This works even when the outer message has no ordinary files.
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' Assumes Chilkat is unlocked. See Global Unlock Sample.
set wrapper = Server.CreateObject("Chilkat.Email")
success = wrapper.LoadEml("forward-as-attachment.eml")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( wrapper.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Cover note: " & wrapper.Subject) & "</pre>"
If (wrapper.NumAttachedMessages = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( "No attached messages.") & "</pre>"
Response.End
End If
set nested = Server.CreateObject("Chilkat.Email")
i = 0
Do While (i < wrapper.NumAttachedMessages)
success = wrapper.GetAttachedEmail(i,nested)
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( wrapper.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Original author: " & nested.From) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "Original subject: " & nested.Subject) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "Files on the original: " & nested.NumAttachments) & "</pre>"
i = i + 1
Loop
%>
</body>
</html>