Sample code for 30+ languages & platforms
Classic ASP

Extract Files from MIME

See more MIME Examples

Extract files from a MIME message.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

set mime = Server.CreateObject("Chilkat.Mime")

' Load a MIME document from a file:
' (.mht and .eml files contain MIME).
success = mime.LoadMimeFile("mst.mht")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
    Response.End
End If

set st = Server.CreateObject("Chilkat.StringTable")
success = mime.PartsToFiles("/temp/mimeParts",st)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
    Response.End
End If

n = st.Count

' Display the paths of the files created:
i = 0
Do While i < n
    Response.Write "<pre>" & Server.HTMLEncode( st.StringAt(i)) & "</pre>"
    i = i + 1
Loop

%>
</body>
</html>