Class MailDistributor
Provides a way for applications to distribute one or more e-mails in batches by using the Simple Mail Transfer Protocol (SMTP).
Inheritance
Namespace: Cuemon.Net.Mail
Assembly: Cuemon.Net.Mail.dll
Syntax
public class MailDistributor
Constructors
| Improve this DocMailDistributor(Func<SmtpClient>, Int32)
Initializes a new instance of the MailDistributor class.
Declaration
public MailDistributor(Func<SmtpClient> carrier, int deliverySize = 20)
Parameters
Type | Name | Description |
---|---|---|
System.Func<SmtpClient> | carrier | The function delegate that will instantiate a new mail carrier per delivery. |
System.Int32 | deliverySize | The maximum number of mails a |
Remarks
A delivery is determined by the deliverySize
. This means, that if you are to send 100 e-mails and you have a deliverySize
of 20,
these 100 e-mails will be distributed to 5 invoked instances of carrier
shipping up till 20 e-mails each (depending if you have a filter or not).
Methods
| Improve this DocSendAsync(IEnumerable<MailMessage>, Func<MailMessage, Boolean>)
Sends the specified sequence of mails
to an SMTP server.
Declaration
public Task SendAsync(IEnumerable<MailMessage> mails, Func<MailMessage, bool> filter = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Net.Mail.MailMessage> | mails | The e-mails to send to an SMTP server. |
System.Func<System.Net.Mail.MailMessage, System.Boolean> | filter | The function delegate that defines the conditions for sending of the |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
The function delegate filter
will only include those mails
that evaluates to true
.
SendOneAsync(MailMessage, Func<MailMessage, Boolean>)
Sends the specified mail
to an SMTP server.
Declaration
public Task SendOneAsync(MailMessage mail, Func<MailMessage, bool> filter = null)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Mail.MailMessage | The e-mail to send to an SMTP server. |
|
System.Func<System.Net.Mail.MailMessage, System.Boolean> | filter | The function delegate that defines the conditions for the sending of |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
The function delegate filter
will only include the mail
if that evaluates to true
.