We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Create email view model.
[Serializable] public class News { public string Title { get; set; } public string Content { get; set; } public string Url { get; set; } }
Create e-mail template (in accordance with view model name) News.cshtml
@inherits Codestellation.Ether.Templating.Razor.RazorMailTemplate<News> @{ Subject = "Latest:" + Model.Title; } <a href="@Model.Url">@Model.Title</a> <p>@Model.Content!</p>
Setup app.config
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="ether" type="Codestellation.Ether.Config.EtherConfigSection, Codestellation.Ether"/> </configSections> <ether fromAddress="me@localhost"> <rules> <rule name="*" recepients="alice@localhost, bob@localhost, admins"/> </rules> <groups> <group name="admins" participants="carol@localhost, dave@localhost"/> </groups> </ether> </configuration>
Use
var notifier = Create.MailNotifier() .FromConfig() .Build(); var mail = new News { Title = "...", Content = "...", Url = "..." }; notifier.Send(mail);