Skip to content
Ilya Dubadenko edited this page Jul 24, 2014 · 3 revisions

Welcome to the Ether wiki!

Get started

  1. Create email view model.

    [Serializable]
    public class News
    {
        public string Title { get; set; }
        public string Content { get; set; }
        public string Url { get; set; }
    }
    
  2. 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>
    
  3. 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>
    
  4. Use

    var notifier = Create.MailNotifier()
                         .FromConfig()
                         .Build();
    var mail = new News
               {
                    Title = "...",
                    Content = "...",
                    Url = "..."
               };
    notifier.Send(mail);    
    
Clone this wiki locally