ASP.NET Core ve Razor View Engine ile Şablon E-Postalar

Razor Templating

Razor View Engine ile tipi belirttiğimiz;

@model RegistrationViewModel
<ItemGroup> <EmbeddedResource Include="templates\**\*.cshtml" Exclude="bin\**;obj\**;packages\**;@(EmbeddedResource)" /> </ItemGroup>
private readonly MailProvider _mailProvider; public MailController(MailProvider mailProvider) { _mailProvider = mailProvider; }
[HttpPost(nameof(SendAsync))] public async Task SendAsync([FromBody]RegistrationEmailViewModel message) { var messageBody = await _mailProvider.RenderMailViewAsync(ControllerContext, MailTemplate.RegistrationComplete, message); await _mailProvider.SendAsync(message.To, message.Subject, messageBody); }




Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store