SendMessage Method  
 

Submits the contents of a specified file to the mail server for delivery.

Syntax

object.SendMessage( Message, [Options] )

Parameters

Message
A string or byte array which contains the message to be delivered. The To:, Cc: and Bcc: header fields will be scanned for recipient addresses, and the Bcc: line will be deleted before the message is delivered.
Options
An optional integer value which specifies one or more options. This argument is reserved for future use and should be omitted.

Return Value

A value of zero is returned if the message was submitted successfully. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The SendMessage method submits the messages to the mail server for delivery. The message format must comply with the RFC 822 standard, with the header and body separated by a blank line, and each line terminated with carriage-return/linefeed characters.

This method will cause the current thread to block until the message transfer completes, a timeout occurs or the transfer is canceled. During the transfer, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

This method requires that the server support the XTND XMIT command. Although using this method to send mail has the advantage that the sender is authenticated (because the user must first login to the server), it is not widely supported. For general purpose mail delivery service, it is recommended that an application use the Simple Mail Transfer Protocol (SMTP).

See Also

StoreMessage Method