Classic ASP
Classic ASP
Enumerate MIME Header Field Values
See more MIME Examples
Demonstrates the Chilkat Mime.GetHeaderFieldValue method, which returns the unfolded value of the header-field occurrence at a zero-based index. The only argument is the index. Continuation (folded) lines are combined into a single value.
Note: The file path is relative to the application's current working directory. Absolute paths may also be used. Supply the path to your own file.
Background: Paired with
GetHeaderFieldName, this lets you list every header as name/value pairs, including duplicates. A useful detail is unfolding: long headers are wrapped across multiple physical lines in the raw message, and this recombines them into the single logical value the header actually represents, so you never have to reassemble continuation lines yourself.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
set mime = Server.CreateObject("Chilkat.Mime")
success = mime.LoadMimeFile("qa_data/message.eml")
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
Response.End
End If
' Iterate the header fields by index and print each name and unfolded value. Continuation lines
' (folded headers) are combined into a single value.
n = mime.NumHeaderFields
For i = 0 To n - 1
fieldName = mime.GetHeaderFieldName(i)
If (mime.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
Response.End
End If
fieldValue = mime.GetHeaderFieldValue(i)
If (mime.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( fieldName & ": " & fieldValue) & "</pre>"
Next
%>
</body>
</html>