Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
asiffermann opened this issue Apr 30, 2021 · 0 comments · May be fixed by #111
Open

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

asiffermann opened this issue Apr 30, 2021 · 0 comments · May be fixed by #111
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@asiffermann
Copy link
Owner

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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant