Class EmailService
Implements IEmailService using the Rimail API to deliver email messages.
Rimail supports a single recipient, a single CC, a single BCC, and a single attachment per message.
When IsSaveAsFile is enabled in the email settings, messages are written to disk
as .eml files via a local SMTP pickup directory instead of being sent.
Implements
Inherited Members
Namespace: DataWeb.Email.Rimail
Assembly: DataWeb.Email.Rimail.dll
Syntax
public class EmailService : IEmailService
Constructors
EmailService(IEnvironmentService, IConfigurationService, IHttpClientFactory)
Implements IEmailService using the Rimail API to deliver email messages.
Rimail supports a single recipient, a single CC, a single BCC, and a single attachment per message.
When IsSaveAsFile is enabled in the email settings, messages are written to disk
as .eml files via a local SMTP pickup directory instead of being sent.
Declaration
public EmailService(IEnvironmentService environmentService, IConfigurationService configurationService, IHttpClientFactory httpClientFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnvironmentService | environmentService | |
| IConfigurationService | configurationService | |
| IHttpClientFactory | httpClientFactory |
Properties
Name
Gets the display name of this email service provider.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
ConvertStreamToByteArrayAsync(Stream)
Converts a Stream to a byte array asynchronously.
Declaration
public static Task<byte[]> ConvertStreamToByteArrayAsync(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to convert. |
Returns
| Type | Description |
|---|---|
| Task<byte[]> | A byte array containing the stream's data. |
SendAsync(EmailMessage, CancellationToken)
Sends an email message asynchronously using the Rimail API.
If IsSaveAsFile is enabled, the message is saved to disk instead.
Declaration
public Task SendAsync(EmailMessage message, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| EmailMessage | message | The email message to send. Cannot be null. |
| CancellationToken | cancellationToken | A token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when required message fields are missing or invalid. |