-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Ilya Dubadenko edited this page Jul 24, 2014
·
3 revisions
-
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);