Sample code for 30+ languages & platforms
Visual FoxPro

Serialize MIME to a String

See more MIME Examples

Demonstrates the Chilkat Mime.GetMime method, which serializes and returns the complete MIME entity — headers, body, multipart boundaries, and all descendants — as a string. It takes no arguments.

Background: This produces the finished MIME text ready to send, store, or hand to another component — the inverse of loading. The whole tree is emitted, including generated multipart boundaries. Because it returns a string, it is best for text-safe content; when the body may contain raw binary bytes, serialize with GetMimeBd to a BinData instead so nothing is altered.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loMime
LOCAL lcMimeText

lnSuccess = 0

*  Demonstrates the Mime.GetMime method, which serializes and returns the complete MIME entity
*  (headers, body, multipart boundaries, and all descendants) as a string.  It takes no
*  arguments.

loMime = CreateObject('Chilkat.Mime')

*  Build a simple MIME entity.
lnSuccess = loMime.SetBodyFromPlainText("Hello, this is the message body.")
IF (lnSuccess = 0) THEN
    ? loMime.LastErrorText
    RELEASE loMime
    CANCEL
ENDIF

*  Serialize it to a string.
lcMimeText = loMime.GetMime()
IF (loMime.LastMethodSuccess = 0) THEN
    ? loMime.LastErrorText
    RELEASE loMime
    CANCEL
ENDIF

? lcMimeText

RELEASE loMime