CSmtpClient::AppendMessage Method  
 
INT AppendMessage(
  LPCTSTR lpszFileName  
);
INT AppendMessage(
  LPBYTE lpMessage,  
  DWORD dwMessageSize  
);
INT AppendMessage(
  HGLOBAL hgblMessage,  
  DWORD dwMessageSize  
);

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

Parameters

lpszFileName
A pointer to a string which specifies the name of a file. The contents of the file are appended to the current message being submitted to the mail server for delivery.
lpMessage
Pointer to a buffer which contains the message data to be appended to the current message.
hgblMessage
A global memory handle which references data that is to be appended to the current message.
dwMessageSize
An unsigned integer which specifies the length of the message in bytes.

Return Value

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

Remarks

The AppendMessage method is used to append the contents of a file, memory buffer, or global memory handle to the current message that is being composed for delivery. To send a complete RFC 822 formatted message, refer to the SendMessage method.

This method 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 EnableEvents, or by registering a callback function using the RegisterEvent method.

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

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csmtpv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

CloseMessage, CreateMessage, SendMessage