Catalyst Internet Mail .NET

InternetMail.SendMessage Method ()

Submit the current message to a mail server for delivery.

[Visual Basic]
Overloads Public Function SendMessage() As Boolean
[C#]
public bool SendMessage();

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The SendMessage method enables an application to send the current message directly to the recipient's mail server or through a relay server. The sender's return address is automatically determined by the value of the From property. The recipient addresses are automatically determined by the value of the To, Cc and Bcc properties.

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.

For each recipient specified in the message, the SendMessage method will determine the appropriate mail exchange server and deliver the message to that user. If the RelayServer and RelayPort properties are defined, then all messages will be relayed through that specific server, regardless of the recipient address. Note that the Secure property and related options only affects connections to relay mail servers. See the RelayServer and RelayPort properties for additional information.

If a relay server is being used, it may require authentication before accepting any messages for delivery. To enable authentication, specify the optionAuthLogin option by setting the Options property. Prior to calling the SendMessage method, the UserName and Password properties should be set to the values that will be used to authenticate the session. If the server does not support authentication, or the user name or password is invalid, an error will be returned. Note that authentication is only performed if a relay server is used, otherwise the option is ignored.

See Also

InternetMail Class | SocketTools Namespace | InternetMail.SendMessage Overload List