Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

Smtp.SendAsync Method

Namespace: Rebex.Net
Assembly: Rebex.Smtp.dll (version 7.0.9147)

SendAsync(MimeMessage, String, String, Object)

Begins asynchronous Send operation. Sends a mail message (MimeMessage).

Declaration
public Task SendAsync(MimeMessage mail, string sender, string recipients, object state = null)
Parameters
Type Name Description
MimeMessage mail

The message.

String sender

Message sender address (can be null or empty).

String recipients

The list of recipients (can be null).

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
Remarks

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 mime message without a sender specified.

SendAsync(MailMessage, String, String, Object)

Begins asynchronous Send operation. Sends a mail message (MailMessage).

Declaration
public Task SendAsync(MailMessage mail, string sender, string recipients, object state = null)
Parameters
Type Name Description
MailMessage mail

The message.

String sender

Message sender address (can be null or empty string).

String recipients

The list of recipients (can be null).

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
Remarks

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 message without a sender specified.

SendAsync(MimeMessage, Object)

Begins asynchronous Send operation. Sends a mail message (MimeMessage).

Declaration
public Task SendAsync(MimeMessage mail, object state = null)
Parameters
Type Name Description
MimeMessage mail

The message.

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
Remarks

Both sender and the list of recipients are extracted from the message. The sender address is taken from the "Sender" header field or from the first address in the "From" field if the "Sender" is missing. The list of recipients comes from "To", "Cc" and "Bcc" header fields. Also, the "Bcc" field is removed from message headers prior to sending. Set the AllowNullSender property to allow sending a mime message without a sender specified.

SendAsync(MailMessage, Object)

Begins asynchronous Send operation. Sends a mail message (MailMessage).

Declaration
public Task SendAsync(MailMessage mail, object state = null)
Parameters
Type Name Description
MailMessage mail

The message.

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
Remarks

Both sender and the list of recipients are extracted from the message. The sender address is taken from the "Sender" header field or from the first address in the "From" field if the "Sender" is missing. The list of recipients comes from "To", "Cc" and "Bcc" header fields. Also, the "Bcc" field is removed from message headers prior to sending. Set the AllowNullSender property to allow sending a mail message without a sender specified.

SendAsync(String, String, String, String, Object)

Begins asynchronous Send operation. Sends a mail message constructed from the specified parameters.

Declaration
public Task SendAsync(string from, string to, string subject, string body, object state = null)
Parameters
Type Name Description
String from

Message sender.

String to

Comma-separated list of message recipients.

String subject

The subject of the message.

String body

The text body of the message.

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
Remarks

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

SendAsync(Stream, String, String, Object)

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

Declaration
public Task SendAsync(Stream input, string sender, string recipients, object state = null)
Parameters
Type Name Description
Stream input

The input stream.

String sender

Message sender address (can be null or empty string).

String recipients

The list of recipients (can be null).

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
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.

SendAsync(Stream, Object)

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

Declaration
public Task SendAsync(Stream input, object state = null)
Parameters
Type Name Description
Stream input

The input stream.

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
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.

Both sender and the list of recipients are extracted from the message. The sender address is taken from the "Sender" header field, or from the first address in the "From" field if the "Sender" is missing. The list of recipients comes from "To", "Cc" and "Bcc" header fields. Also, the "Bcc" field is removed from message headers prior to sending.

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

SendAsync(String, Object)

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

Declaration
public Task SendAsync(string fileName, object state = null)
Parameters
Type Name Description
String fileName

The path to the mail message file.

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
Remarks

The file must be 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.

Both sender and the list of recipients are extracted from the message. The sender address is taken from the "Sender" header field, or from the first address in the "From" field if the "Sender" is missing. The list of recipients comes from "To", "Cc" and "Bcc" header fields. Also, the "Bcc" field is removed from message headers prior to sending.

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

SendAsync(String, String, String, Object)

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

Declaration
public Task SendAsync(string fileName, string sender, string recipients, object state = null)
Parameters
Type Name Description
String fileName

The path to the mail message file.

String sender

Message sender address (can be null or empty string).

String recipients

The list of recipients (can be null).

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task
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 This Article
  • SendAsync(MimeMessage, String, String, Object)
  • SendAsync(MailMessage, String, String, Object)
  • SendAsync(MimeMessage, Object)
  • SendAsync(MailMessage, Object)
  • SendAsync(String, String, String, String, Object)
  • SendAsync(Stream, String, String, Object)
  • SendAsync(Stream, Object)
  • SendAsync(String, Object)
  • SendAsync(String, String, String, Object)
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies