Begins asynchronous Send operation. Reads and sends a mail message from the specified stream in MIME format.

Namespace:  Rebex.Net
Assembly:  Rebex.Smtp (in Rebex.Smtp.dll)

Syntax

Visual Basic
Public Function BeginSend ( _
	input As Stream, _
	sender As String, _
	recipients As String, _
	callback As AsyncCallback, _
	state As Object _
) As IAsyncResult
C#
public IAsyncResult BeginSend(
	Stream input,
	string sender,
	string recipients,
	AsyncCallback callback,
	Object state
)

Parameters

input
Type: System.IO..::..Stream
The input stream.
sender
Type: System..::..String
Message sender address (can be null or empty string).
recipients
Type: System..::..String
The list of recipients (can be null).
callback
Type: System..::..AsyncCallback
An optional asynchronous callback to be called when the operation is complete.
state
Type: System..::..Object
A user-provided object that identifies this particular asynchronous operation.

Return Value

An IAsyncResult that references the asynchronous operation.

Remarks

The stream must contain data in MIME format, other formats are not supported. MIME files often have the '.eml' extension and are produced by Outlook Express. In contrast, Outlook produces '.msg' files that are not MIME files and therefore cannot be sent using this method.

If the sender address argument is null (Nothing in Visual Basic), it is taken from the from the "Sender" header field or from the first address in the "From" field if the "Sender" is missing.
If the sender address argument is empty string, it means null sender - same behavior as if "<>" would be specified.
If the recipients argument is null (Nothing in Visual Basic), it overrides the list of recipients contained in the message. If the recipients argument is null, the list of recipients is extracted from "To", "Cc" and "Bcc" header fields.
The "Bcc" field is removed from message headers prior to sending.

Set the AllowNullSender property to allow sending a mail without a sender specified.

In builds for .NET 4.0 and higher, this method is available as an extension method. Add 'using Rebex.Legacy' (C#) or 'Import Rebex.Legacy' (VB.NET) to your code in order to use it.

Version Information

.NET Compact Framework

Supported in: 3.9, 3.5

See Also