Skip to content

Replace EmailSender polymorphic methods by a fluent API to build an email to be send #30

@asiffermann

Description

@asiffermann

An EmailBuilder would be built with configurable default value (sender email address...)

var emailBuilder = new EmailBuilder()
    .AddSender("")
    .AddReplyTo("")
    .AddRecipient("")
    .AddCarbonCopyRecipient("")
    .AddBlackCarbonCopyRecipient("")
    .AddSubject("")
    .AddAttachment("");

Templated

emailBuilder
    .AddTemplatedBody("TemplateKey", context)
    .AddTemplatedSubject("TemplateKey", context);

HTML

emailBuilder.AddHtmlBody("<html>...");

Plain-text

emailBuilder.AddPlainTextBody("Hello, ...");

Finally build the email and pass it to the provider

await provider.SendEmailAsync(emailBuilder.Build());

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions