SmtpAppendMessage
INT SmtpAppendMessage(
HCLIENT hClient,  
LPVOID lpvMessage,  
DWORD dwMessageSize,  
DWORD dwOptions  
);

The SmtpAppendMessage function writes the contents of a specified file or buffer to the data stream, appending it to the current message contents.

Parameters

hClient
Handle to the client session.
lpvMessage
Pointer to a buffer which contains the message data to be appended, or a pointer to the name of the file which contains the data to be written to the data stream. The use of this parameter depends on the value of the dwOptions parameter.
dwMessageSize
An unsigned long integer which specifies the length of the message in bytes.
dwOptions
Specifes the source of the message data that is to be written to the data stream; it may be one of the following values:
Constant
Description
SMTP_MESSAGE_MEMORY The lpvMessage parameter specifies a pointer to an array of characters. If the value of dwMessageSize is zero, then it is assumed that the data is a null-terminated string.
SMTP_MESSAGE_HGLOBAL The lpvMessage parameter specifies an HGLOBAL which contains the data to be written to the data stream. If the value of the dwMessageSize parameter is zero, then the data is assumed to be null-terminated.
SMTP_MESSAGE_FILE The lpvMessage parameter specifies a pointer to null-terminated string which contains the name of a file. The file is opened and the contents of the file are written to the data stream. The value of the dwMessageSize parameter is ignored when this option is specified.
SMTP_MESSAGE_CLIPBOARD The lpvMessage and dwMessageSize parameters are ignored. The current contents of the clipboard are written to the data stream.

Return Value

If the function succeeds, the return value is zero. If the function fails, the return value is SMTP_ERROR. To get extended error information, call SmtpGetLastError.

Remarks

The SmtpAppendMessage function is used to append the contents of a memory buffer, file or the system clipboard to the current message that is being composed for delivery. To send a complete RFC 822 formatted message, refer to the SmtpSendMessage function.

This function will cause the current thread to block until the complete message has been written, a timeout occurs or the operation is canceled. During the transfer, the SMTP_EVENT_PROGRESS event will be periodically fired, enabling the application to update any user interface controls. Event notification must be enabled, either by calling SmtpEnableEvents, or by registering a callback function using the SmtpRegisterEvent function.

To determine the current status of a transfer while it is in progress, use the SmtpGetTransferStatus function.

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csmtpav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

SmtpCloseMessage, SmtpCreateMessage, SmtpSendMessage


Copyright © 2008 Catalyst Development Corporation. All rights reserved.