Sample code for 30+ languages & platforms
Classic ASP

MIME Multipart Boundary and Preamble Properties

See more MIME Examples

Demonstrates the Boundary property, which gets or sets the raw boundary token of a multipart entity (without surrounding quotation marks), and UseMmDescription, which controls whether the conventional preamble text is emitted when serializing a multipart entity.

Background. A multipart boundary separates the constituent parts. Chilkat quotes the token automatically in the header when required. The preamble is ignored by MIME-aware readers and is off by default.

Chilkat Classic ASP Downloads

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

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

'  Create a multipart/mixed entity.
success = mime.NewMultipartMixed()
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
    Response.End
End If

'  Boundary is the raw boundary token, without surrounding quotation marks.  Chilkat quotes it
'  automatically in the serialized header when required.
mime.Boundary = "example-boundary"

'  UseMmDescription controls whether the conventional preamble text
'  "This is a multi-part message in MIME format." is emitted.  The default is 0.
mime.UseMmDescription = 1

'  Add a simple part so the multipart has content.
set part = Server.CreateObject("Chilkat.Mime")
success = part.SetBodyFromPlainText("First part.")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( part.LastErrorText) & "</pre>"
    Response.End
End If

success = mime.AppendPart(part)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "Boundary = " & mime.Boundary) & "</pre>"

mimeStr = mime.GetMime()
If (mime.LastMethodSuccess = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( mimeStr) & "</pre>"

%>
</body>
</html>