MIME C API Reference
Table of Contents | Previous | Next | Index

Messaging Access SDK Guide
Part 2. Messaging Access SDK C Reference


Chapter 10
MIME C API Reference

This chapter describes the functions and structures of the C language API for the MIME (Multipurpose Internet Mail Extension) protocol of the Messaging Access SDK.

You'll find links to each function and structure in this introduction. Each reference entry gives the name of the function or structure, its header file, its syntax, and its parameters.

All C interface definitions are found in the mime.h and mimeparser.h files.

[Top]

MIME Functions by Functional Group

MIME functions are organized into functional groups. Click the group name to find the reference entries for the functions in the group. To find functions listed in alphabetical order by name, see MIME Functions by Name.

Composite Body Part Types

[Top] [MIME Functions by Task]

MIME Functions by Name

This table lists MIME functions in alphabetical order by name. To find functions listed by functional group, see MIME Functions by Functional Group.

beginDynamicParse
dynamicParse
dynamicParseInputstream
endDynamicParse
getFileMIMEType
mime_basicPart_deleteData 
mime_basicPart_free_all
mime_basicPart_getDataBuf
mime_basicPart_getDataStream
mime_basicPart_getSize
mime_basicPart_putByteStream
mime_basicPart_setDataBuf
mime_basicPart_setDataStream
mimeDataSink_free
mimeDataSink_new
mime_decodeBase64
mime_decodeHeaderString
mime_decodeQP
mimeDynamicParser_free
mimeDynamicParser_new
mime_encodeBase64
mime_encodeHeaderString
mime_encodeQP
mime_Header_free
mime_Header_new
mime_malloc
mime_memfree
mime_message_addBasicPart
mime_message_addMessagePart
mime_message_addMultiPart
mime_message_create
mime_message_deleteBody
mime_message_free_all
mime_message_getBody
mime_message_getContentSubType
mime_message_getContentType
mime_message_getContentTypeParams
mime_message_getHeader
mime_message_putByteStream
mime_messagePart_deleteMessage
mime_messagePart_free_all
mime_messagePart_fromMessage
mime_messagePart_getMessage
mime_messagePart_putByteStream
mime_messagePart_setMessage
mime_multiPart_addBasicPart
mime_multiPart_addFile
mime_multiPart_addMessagePart
mime_multiPart_addMultiPart
mime_multiPart_deletePart
mime_multiPart_free_all
mime_multiPart_getPart
mime_multiPart_getPartCount
mime_multiPart_putByteStream
parseEntireMessage
parseEntireMessageInputstream

[Top] [MIME Functions by Name] [MIME Functions by Task]

Basic (Leaf) Body Part Functions

The MIME BasicPart type includes all Basic MIME BodyPart types, including text, image, audio, video, and application.

This table lists Basic Part functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
mime_basicPart_deleteData 

Deletes the body data of the body part.

mime_basicPart_free_all

Frees the basic part, including all internal structures.

mime_basicPart_getDataBuf

Returns the decoded body data in a buffer.

mime_basicPart_getDataStream

Returns the decoded body data in an input stream.

mime_basicPart_getSize

Returns the size of the body data in bytes.

mime_basicPart_putByteStream

Writes the byte stream for this part with MIME headers and encoded body data.

mime_basicPart_setDataBuf

Sets the body data for this part from a buffer.

mime_basicPart_setDataStream

Sets the body data for this part from an input stream.

[Top] [MIME Functions by Functional Group]

mime_basicPart_deleteData

Deletes the body data of the body part.

Syntax

#include <mime.h> 
int mime_basicPart_deleteData (
            
mime_basicPart_t * in_pBasicPart);

Parameters

The function has the following parameters:
in_pBasicPart

Pointer to data to delete.

Returns

Description

This function deletes the bodyData from a part. After a message is built, you can use one of the MIME delete functions to delete the entire message, the body, or a message part as needed. For more information, see Deleting Parts of a Message.

See Also

mime_multiPart_deletePart, mime_message_deleteBody,
mime_messagePart_deleteMessage
[Top] [Basic (Leaf) Body Part Functions] [MIME Functions by Functional Group]

mime_basicPart_free_all

Frees the basic part, including all internal structures.

Syntax

#include <mime.h> 
int mime_basicPart_free_all(
mime_basicPart_t * in_pBasicPart);

Parameters

The function has the following parameters:
in_pBasicPart

Pointer to data to free.

Returns

Description

This function frees the basic part and its internal structures.

See Also

mime_multiPart_free_all, mime_message_free_all, 
mime_messagePart_free_all, mimeDynamicParser_free
[Top] [Basic (Leaf) Body Part Functions] [MIME Functions by Functional Group]

mime_basicPart_getDataBuf

Returns the decoded body data in a buffer.

Syntax

#include <mime.h> 
int mime_basicPart_getDataBuf (
               
mime_basicPart_t * in_pBasicPart,
               unsigned int * out_pSize
               char ** out_ppDataBuf);

Parameters

The function has the following parameters:
in_pBasicPart

Pointer to data to get.

out_pSize

Pointer to size of the basic part data.

out_ppDataBuf

Pointer to pointer to buffer that contains the data.

Returns

Description

This function returns the decoded body data in a buffer.

For more information, see Building the MIME Message.

See Also

mime_basicPart_getDataStream, mime_basicPart_setDataBuf, 
mime_basicPart_setDataStream
[Top] [Basic (Leaf) Body Part Functions] [MIME Functions by Functional Group]

mime_basicPart_getDataStream

Returns the decoded body data as an input stream.

Syntax

#include <mime.h> 
int mime_basicPart_getDataStream (
               
mime_basicPart_t * in_ppBasicPart,
               char * in_pFileName,
               nsmail_inputstream_t ** out_ppDataStream);

Parameters

The function has the following parameters:
in_ppBasicPart

Pointer to data to retrieve.

in_pFileName

Pointer to the name of a file to retrieve. If null, returns a memory based input-stream.

out_ppDataStream

Pointer to pointer to output data stream.

Returns

Description

This function returns the file named in the in_pFileName parameter. If this parameter is null, the function returns a memory-based input-stream.

For more information, see Building the MIME Message.

See Also

mime_basicPart_getDataBuf, 
mime_basicPart_setDataBuf,
mime_basicPart_setDataStream
[Top] [Basic (Leaf) Body Part Functions] [MIME Functions by Functional Group]

mime_basicPart_getSize

Returns the size of the body data in bytes.

Syntax

#include <mime.h> 
int mime_basicPart_getSize (
               
mime_basicPart_t * in_pBasicPart,
               unsigned int * out_pSize);

Parameters

The function has the following parameters:
in_pBasicPart

Pointer to data to get size for.

out_pSize

Pointer to size of body data to get.

Returns

Description

For more information, see Building the MIME Message.

See Also

mime_basicPart_getDataBuf, mime_basicPart_getDataStream
[Top] [Basic (Leaf) Body Part Functions] [MIME Functions by Functional Group]

mime_basicPart_putByteStream

Writes the byte stream for this part with MIME headers and encoded body data.

Syntax

#include <mime.h> 
int mime_basicPart_putByteStream (
               
mime_basicPart_t * in_pBasicPart,
               mime_outputstream_t * in_pOutput_stream);

Parameters

The function has the following parameters:
in_pBasicPart

Pointer to data to write.

in_pOutput_stream

Pointer to MIME output stream.

Returns

Description

This function encodes the specified basic part with MIME headers and encoded body data. This places the part in MIME canonical format, so that it can be transported using SMTP or any other transport method.

For more information, see Encoding the Message.

See Also

mime_messagePart_putByteStream, 
mime_message_putByteStream,
mime_multiPart_putByteStream
[Top] [Basic (Leaf) Body Part Functions] [MIME Functions by Functional Group]

mime_basicPart_setDataBuf

Sets the body data for this part from a buffer.

Syntax

#include <mime.h> 
int mime_basicPart_setDataBuf (
            
mime_basicPart_t * in_pBasicPart,
            unsigned int in_size,
            const char * in_pDataBuf)
            boolean in_fCopyData);

Parameters

The function has the following parameters:
in_pBasicPart

Pointer to body data.

in_size

Size of body data.

in_pDataBuf

Pointer to buffer that contains body data.

in_fCopyData

Whether the message copies the data or keeps a reference to the data buffer.

Returns

Description

You can add data only to a new, already created mime_basicPart with empty body data. For more information, see Adding Content to the Message.

See Also

mime_basicPart_getDataBuf, mime_basicPart_getDataStream,
mime_malloc, mime_memfree
[Top] [Basic (Leaf) Body Part Functions] [MIME Functions by Functional Group]

mime_basicPart_setDataStream

Sets the body data for this part from an input stream.

Syntax

#include <mime.h> 
int mime_basicPart_setDataStream (
            
mime_basicPart_t * in_pBasicPart,
            mime_inputstream_t * in_ptheDataStream
            boolean in_fCopyData);

Parameters

The function has the following parameters:
in_pBasicPart

Pointer to the body data to set.

in_ptheDataStream

Pointer to the MIME input stream.

in_fCopyData

Whether the message copies the data or keeps a reference to the data buffer.

Returns

Description

You can add data only to new, already created mime_basicPart with empty body data. For more information, see Adding Content to the Message.

See Also

mime_basicPart_getDataBuf, mime_basicPart_getDataStream, 
mime_basicPart_setDataBuf
[Top] [Basic (Leaf) Body Part Functions] [MIME Functions by Functional Group]

Message Functions

The message content type is part of the Composite Body Part Types Group. Message functions create, add to, or perform other operations on the message as a whole.

This table lists Message functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
mime_message_addBasicPart

Adds a basic part as the body of the message.

mime_message_addMessagePart

Adds the message part as the body of the message.

mime_message_addMultiPart

Adds the multipart as the body of the message.

mime_message_create

Creates a message given text-data and a file to attach.

mime_message_deleteBody

Deletes the body part that makes up the body of this message.

mime_message_free_all

Frees the message, including all internal structures.

mime_message_getBody

Returns the body part that makes up the body of the message.

mime_message_getContentSubType

Returns the content subtype of this message.

mime_message_getContentType

Returns the content type of the body of this message.

mime_message_getContentTypeParams

Returns the content type parameters of this message.

mime_message_getHeader

Returns the header value, given the header name.

mime_message_putByteStream

Writes the encoded byte stream for this part to an output stream.

[Top] [MIME Functions by Functional Group]

mime_message_addBasicPart

Adds a basic part as the body of the message.

Syntax

#include <mime.h> 
int mime_message_addBasicPart (
               
mime_message_t * in_pMessage,
               mime_basicPart_t * in_pBasicPart,
               BOOLEAN in_fClone);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message.

in_pBasicPart

Pointer to basic part to add.

in_fClone

Whether the message keeps a reference to the basic part or a cloned copy. Values:

Returns

Description

This function sets the content type according to the message type. If the message body is already present, an error occurs.

For more information, see Building the MIME Message.

See Also

mime_multiPart_addBasicPart, mime_multiPart_addMessagePart, 
mime_multiPart_addMultiPart, mime_multiPart_deletePart,
mime_message_addBasicPart, mime_message_addMultiPart
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_addMessagePart

Adds the message part as the body of the message.

Syntax

#include <mime.h> 
int mime_message_addMessagePart (
                     
mime_message_t * in_pMessage,
                     mime_messagePart_t * in_pMessagePart,
                     BOOLEAN in_fClone);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message.

in_pMessagePart

Pointer to message part to add.

in_fClone

Whether the message keeps a reference to the basic part structure or a cloned copy. Values:

Returns

Description

This function adds the message part and sets the message content type to message part to match the added part. If the message body is already present, an error occurs. For more information, see Building the MIME Message.

See Also

mime_multiPart_addBasicPart, mime_multiPart_addMessagePart, 
mime_multiPart_addMultiPart, mime_multiPart_deletePart,
mime_message_addBasicPart, mime_message_addMultiPart
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_addMultiPart

Adds a multipart as the body of the message.

Syntax

#include <mime.h> 
int mime_message_addMultiPart (
                  
mime_message_t * in_pMessage,
                  mime_multiPart_t * in_pMultiPart,
                  BOOLEAN in_fClone);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message.

in_pMessagePart

Pointer to multipart to add.

in_fClone

Whether the message keeps a reference to the basic part structure or a cloned copy. Values:

Returns

Description

A multipart type is made up of one or more body parts. This function adds a multipart and sets the message content type to multipart to match the type of the added part. If the message body is already present, an error occurs. For more information, see Building the MIME Message.

See Also

mime_multiPart_addBasicPart, mime_multiPart_addMessagePart, 
mime_multiPart_deletePart, mime_message_addBasicPart,
mime_message_addMessagePart
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_create

Creates a message given text-data and a file to attach.

Syntax

#include <mime.h> 
int mime_message_create (char * in_pText,
                  char * in_pFileFullName,
                  mime_encoding_type in_perf_file_encoding,
                  
mime_message_t ** out_ppMessage);

Parameters

The function has the following parameters:
in_pText

Pointer to message text data. Required if in_pFileFullName is null.

in_pFileFullName

Pointer to fully-qualified file-name of file to attach. Required if in_pText is null.

in_perf_file_encoding

Encoding type. For values, see MIME Encoding Types.

out_ppMessage

Pointer to pointer to message to create.

Returns

Description

This function creates a MIME message given either a file attachment or text data, or both. Either a fully-qualified file-name for the in_pFileFullName parameter or the text data for the in_pText parameter is required. MIME creates a message with the parameter it gets, but cannot if both parameters are null; in this case it returns an error.

NOTE: Values for the in_pText and in_pFileFullName parameters can be found upon return from this call. See mime_memfree. §
For more information, see Building the MIME Message.

See Also

mime_multiPart_addBasicPart, mime_multiPart_addMessagePart, 
mime_multiPart_deletePart, mime_message_addBasicPart,
mime_message_addMessagePart, mime_malloc, mime_memfree
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_deleteBody

Deletes the body part that makes up the body of this message.

Syntax

#include <mime.h> 
int mime_message_deleteBody (
                  
mime_message_t * in_pMessage);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message that contains the body part to delete.

Returns

Description

This function deletes a body part that is a message body. After a message is built, you can use one of the MIME delete functions to delete the entire message, the body, or a message part as needed. For more information, see Deleting Parts of a Message.

See Also

mime_basicPart_deleteData, mime_multiPart_deletePart, 
mime_messagePart_deleteMessage
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_free_all

Frees the message including all internal structures.

Syntax

#include <mime.h> 
int mime_message_free_all (
mime_message_t * in_pMessage);

Parameters

The function has the following parameters:
in_pMessage

Pointer to the message to free.

Returns

Description

This function frees the message, including all internal data structures.

See Also

mime_basicPart_free_all, mime_multiPart_free_all, 
mimeDynamicParser_free, mime_messagePart_free_all
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_getBody

Returns the body part that makes up the body of the message.

Syntax

#include <mime.h> 
int mime_message_getBody (
mime_message_t * pMessage,
                           mime_content_type * in_pContentType,
                           void ** out_ppTheBodyPart;

Parameters

The function has the following parameters:
in_pMessage

Pointer to the message.

in_pContentType

Pointer to the MIME Content type. For values, see MIME Content Types.

out_ppTheBodyPart

Pointer to pointer to the body part. The client can cast this based on the value of in_pContentType.

Returns

See Also

mime_message_getContentType
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_getContentSubType

Returns the content subtype of this message.

Syntax

#include <mime.h> 
int mime_message_getContentSubType (
                        
mime_message_t * in_pMessage,
                        char ** out_ppSubType);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message.

out_ppSubType

Pointer to pointer to the MIME subtype of the message.

Returns

Description

This function returns the MIME subtype of this message. For more information, see MIME Content Types.

See Also

mime_message_getContentType, mime_message_getContentTypeParams
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_getContentType

Returns the content type of this message.

Syntax

#include <mime.h> 
int mime_message_getContentType (
                     
mime_message_t * in_pMessage,
                     mime_content_type * out_content_type);

Parameters

The function has the following parameters:
in_pMessage

Pointer to the message.

out_content_type

Pointer to the MIME content type. For values, see MIME Content Types.

Returns

Description

The content type can be text, image, audio, video, or application. For more information, see MIME Content Types.

See Also

mime_message_getContentTypeParams
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_getContentTypeParams

Returns the content_type parameters of this message.

Syntax

#include <mime.h> 
int mime_message_getContentTypeParams (
                           
mime_message_t * in_pMessage,
                           char ** out_ppParams);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message.

out_pParams

Pointer to pointer to the content type parameters of the message.

Returns

See Also

mime_message_getContentType
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_getHeader

Returns the header value, given the header name.

Syntax

#include <mime.h> 
int mime_message_getHeader (
                  
mime_message_t * in_pMessage,
                  char * in_pName,
                  char ** out_ppValue);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message.

in_pName

Pointer to the header name.

out_ppValue

Pointer to pointer to the header value.

Returns

Description

This function returns the value of the header, given the header name, it is in the message).

See Also

mime_message_getContentType
[Top] [Message Functions] [MIME Functions by Functional Group]

mime_message_putByteStream

Writes the encoded byte stream for this part to an output stream.

Syntax

#include <mime.h> 
int mime_message_putByteStream (
               
mime_message_t * in_pMessage,
               nsmail_outputstream_t * in_pOutput_stream);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message that contains the body part.

in_pOutput_stream

Pointer to the MIME output stream to write to.

Returns

Description

This function encodes the specified part with MIME headers and encoded body data. This places the part in MIME canonical format, so that it can be transported using SMTP or any other transport method.

For more information, see Encoding the Message.

See Also

mime_multiPart_putByteStream, mime_messagePart_putByteStream
[Top] [MIME Functions by Functional Group] [MIME Functions by Functional Group] [MIME Functions by Task]

Message Part Functions

The Message Part body part represents a message that becomes the content of a another message, for example, when forwarded.

This table lists Message Part functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
mime_messagePart_deleteMessage

Deletes the MIME message that makes up the body of this part.

mime_messagePart_free_all

Frees the message part, including all internal structures.

mime_messagePart_fromMessage

Creates a message part from a message structure.

mime_messagePart_getMessage

Retrieves the message from the message part.

mime_messagePart_putByteStream

Writes the encoded byte stream for this part with MIME headers and encoded body data.

mime_messagePart_setMessage

Sets a message as the body of this message part.

[Top] [MIME Functions by Functional Group]

mime_messagePart_deleteMessage

Deletes the MIME message that makes up the body of this part.

Syntax

#include <mime.h> 
int mime_messagePart_deleteMessage (
               
mime_messagePart_t * in_pMessagePart);

Parameters

The function has the following parameters:
in_pMessagePart

Pointer to message part.

Returns

Description

This function deletes a forwarded MIME message from a part. After a message is built, you can use one of the MIME delete functions to delete the entire message, the body, or a message part as needed. For more information, see Deleting Parts of a Message.

See Also

mime_basicPart_deleteData, mime_multiPart_deletePart, 
mime_message_deleteBody
[Top] [Message Part Functions] [MIME Functions by Functional Group]

mime_messagePart_free_all

Frees the message part, including all internal structures.

Syntax

#include <mime.h> 
int mime_messagePart_free_all (
            
mime_messagePart_t * in_pMessagePart);

Parameters

The function has the following parameter:
in_pMessagePart

Pointer to message part to free.

Returns

Description

This function frees the message part and its internal structures.

See Also

mime_basicPart_free_all, mime_multiPart_free_all, 
mime_message_free_all, mimeDynamicParser_free
[Top] [Message Part Functions] [MIME Functions by Functional Group]

mime_messagePart_fromMessage

Creates a message part from a message structure.

Syntax

#include <mime.h> 
int mime_messagePart_fromMessage (
               
mime_message_t * in_pMessage,
               mime_messagePart_t ** out_ppMessagePart);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message structure to use to create part.

out_ppMessagePart

Pointer to pointer to message part to create.

Returns

Description

For more information, see Adding Content to the Message.

See Also

mime_messagePart_getMessage, mime_message_create
[Top] [Message Part Functions] [MIME Functions by Functional Group]

mime_messagePart_getMessage

Retrieves the message from the message part.

Syntax

#include <mime.h> 
int mime_messagePart_getMessage (
               
mime_messagePart_t * in_pMessagePart,
               mime_message_t ** out_ppMessage);

Parameters

The function has the following parameters:
in_pMessage

Pointer to message structure.

out_ppMessagePart

Pointer to pointer to message part.

Returns

See Also

mime_messagePart_fromMessage, mime_messagePart_setMessage
[Top] [Message Part Functions] [MIME Functions by Functional Group]

mime_messagePart_putByteStream

Writes the byte stream for this part to an output stream.

Syntax

#include <mime.h> 
int mime_messagePart_putByteStream (
               
mime_messagePart_t * in_pMessagePart,
               mime_outputstream_t * in_pOutput_stream);

Parameters

The function has the following parameters:
in_pMessagePart

Pointer to message part.

in_pOutput_stream

Pointer to MIME output stream.

Returns

Description

For more information, see Encoding the Message.

See Also

mime_multiPart_putByteStream, mime_message_putByteStream
[Top] [Message Part Functions] [MIME Functions by Functional Group]

mime_messagePart_setMessage

Sets the parsed message as the body of this message part.

Syntax

#include <mime.h> 
int mime_messagePart_setMessage (
               
mime_messagePart_t * in_pMessagePart,
               mime_message_t * in_pMessage);

Parameters

The function has the following parameters:
in_pMessagePart

Pointer to message part.

in_pMessage

Pointer to message.

Returns

Description

If you try to set a message that has already been set, you get an error message. For more information, see Building the MIME Message.

See Also

mime_messagePart_getMessage
[Top] [Message Part Functions] [MIME Functions by Functional Group]

Multipart Functions

The multipart content type is part of the Composite Body Part Types Group. It describes a message that is made up of one or more sub-body parts. The multipart type has several subtypes that describe how the sub-parts relate to each other, including mixed, alternative, digest, and parallel.

This table lists Multipart functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
mime_multiPart_addBasicPart

Adds a basic part to the multipart.

mime_multiPart_addFile

Adds a file as basic part to the multipart.

mime_multiPart_addMessagePart

Adds a message part to the multipart.

mime_multiPart_addMultiPart

Adds a message part to the multipart.

mime_multiPart_deletePart

Deletes the body part at the specified index from this multipart.

mime_multiPart_free_all

Frees the multipart, including all internal structures.

mime_multiPart_getPart

Returns the body part at the specified index.

mime_multiPart_getPartCount

Returns the count of the body parts in this multipart.

mime_multiPart_putByteStream

Writes the byte stream for this part with MIME headers and encoded body data.

[Top] [MIME Functions by Functional Group]

mime_multiPart_addBasicPart

Adds a basic part to the multipart.

Syntax

#include <mime.h> 
int mime_multiPart_addBasicPart (
               
mime_multiPart_t * in_pMultiPart,
               mime_basicPart_t * in_pBasicPart,
               boolean in_fClone,
               int * out_pIndex_assigned);

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart to add basic part to.

in_pBasicPart

Pointer to basic part to add.

in_fClone

Whether the message keeps a reference to the basic part structure or a cloned copy. Values:

out_pIndex_assigned

Pointer to index where the basic part should be added.

Returns

Description

This function adds an existing basic part to a multipart at the specified index. The in_fClone parameter specifies whether the function returns the body part or a cloned copy. For more information, see Adding a Basic Part to a Multipart.

See Also

mime_multiPart_addMessagePart, mime_multiPart_addMultiPart, 
mime_multiPart_deletePart, mime_message_addBasicPart,
mime_message_addMessagePart, mime_message_addMultiPart
[Top] [Multipart Functions] [MIME Functions by Functional Group]

mime_multiPart_addFile

Adds a file as basic part to the multipart.

Syntax

#include <mime.h> 
int mime_multiPart_addFile (
            
mime_multiPart_t * in_pMultiPart,
            char * in_pFileFullName,
            mime_encoding_type in_perf_file_encoding,
            int * out_index_assigned);

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart to add file to.

in_pFileFullName

Pointer to fully-qualified filename of existing file to attach.

in_perf_file_encoding

Encoding type. For values, see MIME Encoding Types.

out_index_assigned

Pointer to index.

Returns

Description

The file added by this function must already exist and you must identify it with a fully-qualified file-name including PATH. If either the in_pText or in_pFileFullName parameter is null, the function creates a MIME message with the non-null parameter. If both parameters are null, an error is returned.

For more information, see Building the MIME Message.

See Also

mime_multiPart_addMessagePart, mime_multiPart_addMultiPart, 
mime_multiPart_deletePart, mime_message_addBasicPart,
mime_message_addMessagePart, mime_message_addMultiPart
[Top] [Multipart Functions] [MIME Functions by Functional Group]

mime_multiPart_addMessagePart

Adds a message part to the multipart.

Syntax

#include <mime.h> 
int mime_multiPart_addMessagePart (
                        
mime_multiPart_t * in_pMultiPart,
                        mime_messagePart_t * in_pMessagePart,
                        BOOLEAN in_fClone,
                        int * out_Index_assigned);

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart to add message part to.

in_pMessagePart

Pointer to message part to add.

in_fClone

Whether the message keeps a reference to the basic part structure or a cloned copy. Values:

out_Index_assigned

Pointer to index.

Returns

Description

For more information, see Building the MIME Message.

See Also

mime_multiPart_addBasicPart, mime_multiPart_addMultiPart, 
mime_multiPart_deletePart, mime_message_addBasicPart,
mime_message_addMessagePart, mime_message_addMultiPart
[Top] [Multipart Functions] [MIME Functions by Functional Group]

mime_multiPart_addMultiPart

Adds a multipart to the multipart.

Syntax

#include <mime.h> 
int mime_multiPart_addMultiPart (
            
mime_multiPart_t * in_pMultiPart,
            mime_multiPart_t * in_pMultiPartToAdd,
            boolean in_fClone,
            int * out_Index_assigned);

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart to which to add the message part.

in_pMultiPartToAdd

Pointer to multipart to add.

in_fClone

Whether the message keeps a reference to the basic part structure or a cloned copy. Values:

out_Index_assigned

Pointer to index.

Returns

Description

For more information, see Building the MIME Message.

See Also

mime_multiPart_addBasicPart, mime_multiPart_addMessagePart, 
mime_multiPart_deletePart, mime_message_addBasicPart,
mime_message_addMessagePart, mime_message_addMultiPart
[Top] [Multipart Functions] [MIME Functions by Functional Group]

mime_multiPart_deletePart

Deletes the body part at the requested index from this multipart.

Syntax

#include <mime.h> 
int mime_multiPart_deletePart (
                        
mime_multiPart_t * in_pMultiPart,
                        int in_index);

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart from which to delete the message part.

in_index

Index.

Returns

Description

This function deletes the body part at the specified index. After a message is built, you can use one of the MIME delete functions to delete the entire message, the body, or a message part as needed. For more information, see Deleting Parts of a Message.

See Also

mime_basicPart_deleteData, 
mime_messagePart_deleteMessage,
mime_message_deleteBody
[Top] [Multipart Functions] [MIME Functions by Functional Group]

mime_multiPart_free_all

Frees the multipart including all internal structures.

Syntax

#include <mime.h> 
int mime_multiPart_free_all (
            
mime_multiPart_t * in_pMultiPart);

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart to free.

Returns

Description

This function frees the multipart and its internal structures.

See Also

mime_basicPart_free_all, mime_message_free_all, 
mime_messagePart_free_all, mimeDynamicParser_free
[Top] [Multipart Functions] [MIME Functions by Functional Group]

mime_multiPart_getPart

Returns the body part at the specified index.

Syntax

#include <mime.h> 
int mime_multiPart_getPart (
               
mime_multiPart_t * in_pMultiPart,
               int in_index,
               mime_content_type * in_pContentType,
               void ** out_ppTheBodyPart );

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart.

in_index

Index target for body part.

in_pContentType

Pointer to MIME Content type. For values, see MIME Content Types.

out_ppTheBodyPart

Pointer to pointer to body part. Client can cast this based on the type in the in_pContentType parameter.

Returns

Description

This function returns the body part, specified by its index in the in_index parameter.

See Also

mime_multiPart_getPartCount
[Top] [Multipart Functions] [MIME Functions by Functional Group]

mime_multiPart_getPartCount

Returns the count of the body parts in this multipart.

Syntax

#include <mime.h> 
int mime_multiPart_getPartCount (
               
mime_multiPart_t * in_pMultiPart,
               int * count);

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart for which to count parts.

count

Pointer to number of parts.

Returns

See Also

mime_multiPart_getPart
[Top] [Multipart Functions] [MIME Functions by Functional Group]

mime_multiPart_putByteStream

Writes out the encoded byte stream for this multipart with MIME headers and encoded body data.

Syntax

#include <mime.h> 
int mime_multiPart_putByteStream (
                  
mime_multiPart_t * in_pMultiPart,
                  nsmail_outputstream_t * in_pOutput_stream);

Parameters

The function has the following parameters:
in_pMultiPart

Pointer to multipart.

out_pOutput_stream

Pointer to MIME output stream.

Returns

Description

This function encodes the specified multipart with MIME headers and encoded body data. This places the part in MIME canonical format, so that it can be transported using SMTP or any other transport method.

For more information, see Encoding the Message.

See Also

mime_messagePart_putByteStream, 
mime_message_putByteStream, mime_basicPart_putByteStream
[Top] [Multipart Functions] [MIME Functions by Functional Group]

MIME Utility Functions

MIME utility functions perform specialized encoding and decoding. In addition, two convenience functions create and destroy headers.

This table lists MIME Utility functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
getFileMIMEType

Returns the MIME type information for the specified file, based on file extension.

mime_decodeBase64

Decodes Base64-encoded data and writes it to an output stream.

mime_decodeHeaderString

Decodes and returns a header string.

mime_decodeQP

Decodes Quoted Printable-encoded data and writes it to an output stream.

mime_encodeBase64

Encodes the data from an input stream and writes it to an output stream, using Base64 encoding.

mime_encodeHeaderString

Encodes a header string.

mime_encodeQP

Encodes data using QP encoding.

mime_Header_free

Frees a MIME header.

mime_Header_new

Builds and returns a MIME header, given header name and value.

mime_malloc

Allocates memory for use with the MIME API.

mime_memfree

Frees memory allocated by the SDK.

[Top] [MIME Functions by Functional Group]

mime_decodeBase64

Decodes Base64-encoded data and writes it to the output stream.

Syntax

#include <mime.h> 
int mime_decodeBase64 (
               
nsmail_inputstream_t * in_pInput_stream,
               nsmail_outputstream_t * in_pOutput_stream);

Parameters

The function has the following parameters:
in_pInput_stream

Pointer to the MIME input stream source of data to encode.

out_pOutput_stream

Pointer to the MIME output stream target for encoded data.

Returns

Description

This function decodes Base-64-encoded data from the input_stream and writes it to the output_stream. Base64 is the default encoding for non-Text content types.

See Also

mime_decodeHeaderString, mime_decodeQP,
mime_encodeBase64
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_decodeHeaderString

Decodes and returns a header string.

Syntax

#include <mime.h> 
int mime_decodeHeaderString (char * inString,
                              char ** out_ppString);

Parameters

The function has the following parameters:
inString

Pointer to header string that was encoded according to RFC 2047 rules.

out_ppString

Pointer to pointer to decoded output.

Returns

Description

If the input string is not encoded according to RFC 2047 rules, this function returns the same input string. Otherwise, it decodes and returns the decoded string.

For more information, see Parsing the Entire Message.

See Also

mime_decodeBase64, mime_decodeQP, mime_encodeHeaderString
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_decodeQP

Decodes Quoted Printable-encoded data and writes it to the output stream.

Syntax

#include <mime.h> 
int mime_decodeQP (
mime_inputstream_t * in_pInput_stream,
                   mime_outputstream_t * out_pOutput_stream

Parameters

The function has the following parameters:
in_pInput_stream

Pointer to the MIME input stream source of data to encode.

out_pOutput_stream

Pointer to the MIME output stream target for encoded data.

Returns

Description

This function decodes QuotedPrintable-encoded data from the input_stream and writes it to the output_stream. For more information, see Parsing the Entire Message

See Also

mime_decodeBase64, mime_decodeHeaderString, mime_encodeQP
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_encodeBase64

Encodes the data from an input stream and writes it to an output stream, using Base64 encoding.

Syntax

#include <mime.h> 
int mime_encodeBase64 (
            
mime_inputstream_t * in_pInput_stream,
            mime_outputstream_t * out_pOutput_stream);

Parameters

The function has the following parameters:
in_pInput_stream

Pointer to the MIME input stream source of data to encode.

out_pOutput_stream

Pointer to the MIME output stream target for encoded data.

Returns

Description

For more information, see Encoding and Decoding Utilities.

See Also

mime_encodeHeaderString, mime_encodeQP, mime_decodeBase64
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_encodeHeaderString

Encodes a header string.

Syntax

#include <mime.h> 
int mime_encodeHeaderString (char * inString,
                  char * in_charset,
                  char in_encoding,
                  char ** out_ppOutString);

Parameters

The function has the following parameters:
inString

Pointer to the header string to encode. Header must conformity RFC 2047 requirements.

in_charset

Pointer to the character set that contains the input string.

in_encoding

Encoding type. Values: 'Q' or 'B'

out_ppOutString

Pointer to pointer to the MIME output stream.

Returns

Description

This function encodes a header string as defined in RFC 2047. The encoded string can be used as the value of unstructured headers or in the comments section of structured headers. For a complete list, see Encoding and Decoding Headers.

See Also

mime_encodeBase64, mime_encodeQP, mime_decodeHeaderString
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_encodeQP

Encodes the data from an input_stream and writes to an output_stream, using QP encoding.

Syntax

#include <mime.h> 
int mime_encodeQP (
         
mime_inputstream_t * in_pInput_stream,
         mime_outputstream_t * out_pOutput_stream);

Parameters

The function has the following parameters:
in_pInput_stream

Pointer to the MIME input stream source of data to encode.

out_pOutput_stream

Pointer to the MIME output stream target for encoded data.

Returns

Description

For more information, see Encoding and Decoding Utilities.

See Also

mime_encodeBase64, mime_encodeHeaderString, mime_encodeQP
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_Header_free

Frees a MIME header.

Syntax

#include <mime.h> 
int mime_header_free (
mime_header_t * in_pHdr);

Parameters

The function has the following parameters:
in_pHdr

Pointer to the header string to free.

Returns

Description

This function frees a mime_header_t structure.

See Also

mime_Header_new, mime_header_t, 
mime_basicPart_free_all, mime_multiPart_free_all,
mime_message_free_all, mime_messagePart_free_all
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_Header_new

Builds and returns a MIME header, given header name and value.

Syntax

#include <mime.h> 
mime_header_t * mime_header_new (char * in_pName,
                                 char * in_pValue);

Parameters

The function has the following parameters:
in_pName

Pointer to the name portion of the header.

pValue

Pointer to the value portion of the header.

Returns

Description

This function can create a mime_header_t structure with either or both of the name and value parameters. If both are null, the function returns null. For more information, see Adding Message Headers.

See Also

mime_header_t, mime_Header_free
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

getFileMIMEType

Returns the MIME type information for the specified file, based on file extension.

Syntax

#include <mime.h> 
int getFileMIMEType (char * in_pFilename_ext,
                     
file_mime_type * in_pFileMIMEType);

Parameters

The function has the following parameters:
in_pFilename_ext

Pointer to the file extension. If null, returns application/octet-stream.

in_pFileMIMEType

Pointer to the MIME type of the file. Default: application/octet-stream.

Returns

Description

Based on file extension, this method attempts to determine the file MIME type. By default, it returns the application/octet-stream.

This helper method is useful for attaching files and setting their MIME-types automatically.

See Also

mime_encodeBase64, mime_encodeHeaderString, mime_encodeQP
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_malloc

Allocates memory for use with the MIME API.

Syntax

#include <mime.h> 
void * mime_malloc (unsigned int in_size);

Parameters

The function has the following parameter:
in_size

Size of memory to allocate.

Returns

Description

This function allocates memory of the specified size. It is preferable to use this function instead of malloc for memory you are allocating for use with the MIME API. By using mime_malloc, you avoid heap space conflicts that can occur when the mail application links with two or more libraries that support malloc and free.

Internally, this function simply invokes malloc, so its semantics and usage are identical to those of malloc.

See Also

mime_memfree
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

mime_memfree

Frees memory allocated by the SDK.

Syntax

#include <mime.h> 
void mime_memfree (void * in_pMem);

Parameters

The function has the following parameter:
in_pMem

Memory to free.

Returns

Description

This function frees any memory allocated by the SDK. This includes data buffers returned by mime_basicPart_getDataBuf and memory allocated using mime_malloc.

Internally, this function simply invokes free, so its semantics and usage are identical to those of free.

See Also

mime_malloc, mime_basicPart_getDataBuf
[Top] [MIME Utility Functions] [MIME Functions by Functional Group]

Dynamic Parsing Functions

These functions provide the capabilities of the dynamic parser. For more information, see Dynamic Parsing.

This table lists Dynamic Parsing functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
beginDynamicParse

Begins parsing a new message.

dynamicParse

Continues to parse data from a data buffer.

dynamicParseInputstream

Callback routine for parsing chunks of data from an input stream.

endDynamicParse

Continues to parse data from an input stream.

mimeDynamicParser_free

Frees the dynamic parser.

mimeDynamicParser_new

Creates a dynamic parser.

[Top] [MIME Functions by Functional Group]

beginDynamicParse

Begins parsing a new message.

Syntax

#include <mimeparser.h> 
int beginDynamicParse( struct mimeParser * in_pParser );

Parameters

The function has the following parameter:
 in_pParser

Pointer to parser you are using.

Returns

Description

For more information, see Dynamic Parsing.

See Also

mimeDynamicParser_new
[Top] [Dynamic Parsing Functions] [MIME Functions by Functional Group]

dynamicParse

Continues to parse data from a data buffer.

Syntax

#include <mimeparser.h> 
int dynamicParse( struct mimeParser *in_pParser,
                  char * in_pData, int in_nLen );

Parameters

The function has the following parameters:
in_pParser

Pointer to the parser.

in_pData

Pointer to the input stream.

in_nLen

Length of data to parse.

Returns

Description

For more information, see Dynamic Parsing.

See Also

dynamicParseInputstream
[Top] [Dynamic Parsing Functions] [MIME Functions by Functional Group]

dynamicParseInputstream

Continues to parse data from an input-stream.

Syntax

#include <mimeparser.h> 
int dynamicParseInputstream(
               struct mimeParser *in_pParser,
               struct nsmail_inputstream *in_pInput);

Parameters

The function has the following parameters:
in_pParser

Pointer to the parser.

in_pInput

Pointer to data to parse.

Returns

Description

For more information, see Dynamic Parsing.

See Also

dynamicParse
[Top] [Dynamic Parsing Functions] [MIME Functions by Functional Group]

endDynamicParse

Tells the parser that there is no more data to parse.

Syntax

#include <mimeparser.h> 
int endDynamicParse( struct mimeParser *in_pParser );

Parameters

The function has the following parameter:
in_pParser

Pointer to the parser.

Returns

Description

For more information, see Dynamic Parsing.

See Also

dynamicParseInputstream
[Top] [Dynamic Parsing Functions] [MIME Functions by Functional Group]

mimeDynamicParser_free

Frees the dynamic parser.

Syntax

#include <mimeparser.h> 
void mimeDynamicParser_free(
               struct mimeParser ** in_ppParser );

Parameters

The function has the following parameter:
in_ppParser

Pointer to pointer to the parser.

Description

For more information, see Dynamic Parsing.

See Also

beginDynamicParse, mime_basicPart_free_all, 
mime_multiPart_free_all, mime_message_free_all,
mime_messagePart_free_all
[Top] [Dynamic Parsing Functions] [MIME Functions by Functional Group]

mimeDynamicParser_new

Creates a dynamic parser.

Syntax

#include <mimeparser.h> 
int mimeDynamicParser_new(
               
mimeDataSink_t * in_pDataSink,
               struct mimeParser ** out_ppParser);

Parameters

The function has the following parameters:
in_pDataSink

Pointer to data sink to use for callbacks; if no callbacks are made: null.

out_ppParser

Pointer to pointer to the dynamic parser you are using.

Returns

Description

This function creates the dynamic parser. If the parse operation is not going to use callbacks to a data sink, the value for pdataSink should be null.

For more information, see Dynamic Parsing and Creating the Dynamic Parser.

See Also

beginDynamicParse, mimeDynamicParser_free
[Top] [Dynamic Parsing Functions] [MIME Functions by Functional Group]

Message Parsing Functions

These functions provide MIME parsing functions. For more information, see Parsing MIME Messages.

his table lists MIME Data Sink functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
parseEntireMessage

Parses an entire message from a data buffer.

parseEntireMessageInputstream

Parse an entire message from an input stream.

[Top] [MIME Functions by Functional Group]

parseEntireMessage

Parses an entire message from a data buffer.

Syntax

#include <mimeparser.h> (
int parseEntireMessage (char * in_pData,
                        int in_nLen,
                        struct mime_message ** in_ppMimeMessage

Parameters

The function has the following parameters:
in_pData

Pointer to the data buffer

in_nLen

Length of data to parse.

in_ppMimeMessage

Pointer to pointer to the MIME message.

Returns

Description

This function is one of two routines for parsing an entire message. parseEntireMessage parses data received from a data buffer, while parseEntireMessageInputstream parses an entire message from an input stream.

For more information, see Parsing the Entire Message.

See Also

parseEntireMessageInputstream
[Top] [Message Parsing Functions] [MIME Functions by Functional Group]

parseEntireMessageInputstream

Parses an entire message in a single operation from an input stream.

Syntax

#include <mimeparser.h> 
int parseEntireMessageInputstream(
            struct nsmail_inputstream *in_pInput,
            struct mime_message ** out_ppMimeMessage);

Parameters

The function has the following parameters:
in_pInput

Pointer to the input stream

out_ppMimeMessage

Pointer to pointer to MIME message.

Returns

Description

This function is one of two routines for parsing an entire message in a single operation. parseEntireMessage parses data received from a data buffer, while parseEntireMessageInputstream parses an entire message from an input stream.

For more information, see Parsing the Entire Message.

See Also

parseEntireMessage
[Top] [Message Parsing Functions] [MIME Functions by Functional Group]

Data Sink Functions

These functions create and destroy the MIME data sink. For more information, see Creating a Data Sink.

This table lists MIME Data Sink functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
mimeDataSink_free

Frees a MIME data sink and its data members.

mimeDataSink_new

Creates a new data sink.

[Top] [MIME Functions by Functional Group]

mimeDataSink_free

Frees a MIME data sink and its data members.

Syntax

#include <mimeparser.h> 
void mimeDataSink_free(
mimeDataSink_t ** pp );

Parameters

The function has the following parameter:
pp 

Pointer to pointer to MIME data sink to free.

Returns

Description

This function frees all mimeDataSink function pointers and deallocates its storage space. The user must free any opaque data.

For more information, see Creating a Data Sink.

See Also

parseEntireMessage, mimeDataSink_t, mimeDataSink_new
[Top] [Data Sink Functions] [MIME Functions by Functional Group]

mimeDataSink_new

Creates a new data sink.

Syntax

#include <mimeparser.h> 
int mimeDataSink_new(
mimeDataSink_t **pp );

Parameters

The function has the following parameters:
pp 

Pointer to pointer to MIME data sink.

Returns

Description

This function initializes all mimeDataSink function pointers and allocates space for the structure. The data sink is made up of function pointers and opaque data, which are set to null when the sink is initialized.

For more information, see Creating a Data Sink and SDK Response Sinks for C.

See Also

parseEntireMessage, mimeDataSink_t, mimeDataSink_free
[Top] [Data Sink Functions] [MIME Functions by Functional Group]


Table of Contents | Previous | Next | Index

Last Updated: June 3, 1998

Copyright © 1998 Netscape Communications Corporation