The SendMessage method is used to send the contents of a
file, buffer or global memory handle to the specified recipients. The
message must be in the standard format as described in RFC 822. The
CMailMessage class can be used to compose and export
a message in the correct format.
This protocol is only concerned with the delivery of a message and
not its contents. Header fields in the message are not parsed to
determine the recipients. This recipient parameter should be a
concatenation of all recipients, including carbon copies and blind
carbon copies, with each address separated with a comma.
This method will cause the current thread to block until the
complete message has been delivered, 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 the transaction while it is in
progress, use the GetTransferStatus method.
An alternative approach to creating a message without using
the CMailMessage class is the SubmitMessage
method. It accepts two structure parameters which define the message
contents and the connection information for the mail server. This
enables the application to compose the message and submit it for
delivery in a single method call.