MailDistributor Class
Definition
Provides a way for applications to distribute one or more e-mails in batches by using the Simple Mail Transfer Protocol (SMTP).
public class MailDistributor
- Inheritance
-
objectMailDistributor
Examples
The following example demonstrates how to construct a
using System;
using System.Net.Mail;
using System.Threading.Tasks;
using Cuemon.Net.Mail;
namespace MyApp.Examples;
public static class MailDistributorExample
{
public static async Task DemonstrateAsync()
{
var distributor = new MailDistributor(() => new SmtpClient("smtp.example.com", 25), deliverySize: 10);
using var mail = new MailMessage("sender@example.com", "receiver@example.com")
{
Subject = "Docs sample",
Body = "This message is filtered out before delivery."
};
await distributor.SendOneAsync(mail, _ => false);
Console.WriteLine("Delivery skipped by filter.");
}
}
Constructors
| Name | Description |
|---|---|
| MailDistributor(Func<SmtpClient>, int) | Initializes a new instance of the MailDistributor class. |
Methods
| Name | Description |
|---|---|
| SendAsync(IEnumerable<MailMessage>, Func<MailMessage, bool>) | Sends the specified sequence of |
| SendOneAsync(MailMessage, Func<MailMessage, bool>) | Sends the specified |