41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
namespace PowderCoating.Application.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Represents a file to attach to an outbound email.
|
|
/// </summary>
|
|
public record EmailAttachment(byte[] Data, string Filename, string ContentType);
|
|
|
|
public interface IEmailService
|
|
{
|
|
/// <summary>
|
|
/// Sends a plain or HTML email, optionally with a single file attachment (used for invoice
|
|
/// and quote PDFs). For multiple attachments such as job photos use
|
|
/// <see cref="SendEmailWithAttachmentsAsync"/>.
|
|
/// </summary>
|
|
Task<(bool Success, string? ErrorMessage)> SendEmailAsync(
|
|
string toEmail,
|
|
string toName,
|
|
string subject,
|
|
string plainTextBody,
|
|
string? htmlBody = null,
|
|
byte[]? attachmentData = null,
|
|
string? attachmentFilename = null,
|
|
string? attachmentContentType = null,
|
|
string? replyToEmail = null,
|
|
string? replyToName = null);
|
|
|
|
/// <summary>
|
|
/// Sends an email with one or more file attachments (e.g. job photos). Callers are
|
|
/// responsible for keeping total attachment size under SendGrid's 30 MB per-message limit.
|
|
/// </summary>
|
|
Task<(bool Success, string? ErrorMessage)> SendEmailWithAttachmentsAsync(
|
|
string toEmail,
|
|
string toName,
|
|
string subject,
|
|
string plainTextBody,
|
|
string? htmlBody = null,
|
|
IList<EmailAttachment>? attachments = null,
|
|
string? replyToEmail = null,
|
|
string? replyToName = null);
|
|
}
|