Example #1
0
        static void Main()
        {
            const string body = "Привет! Высылаю следующее домашнее задание (Смажилюк Игорь).";

            IEmailBuilder emailBuilder = new StateEmailBuilder()
                                         .AddReceiverAndBody("*****@*****.**", body)
                                         .AddReceiver("*****@*****.**")
                                         .SetSubject("Домашнее задание №3 (Builder)");

            IEmail email = emailBuilder.CreateEmail();

            IEmailSender emailSender = new ConsoleEmailSender();

            emailSender.Send(email);
        }
Example #2
0
    static void Main(string[] args)
    {
        Email e1 = new Email()
        {
            From = "Me", To = "Vasya", Theme = "Who are you?"
        };
        Email e2 = new Email()
        {
            From = "Vasya", To = "Me", Theme = "vacuum cleaners!"
        };
        Email e3 = new Email()
        {
            From = "Kolya", To = "Vasya", Theme = "No! Thanks!"
        };
        Email e4 = new Email()
        {
            From = "Vasya", To = "Me", Theme = "washing machines!"
        };
        Email e5 = new Email()
        {
            From = "Me", To = "Vasya", Theme = "Yes"
        };
        Email e6 = new Email()
        {
            From = "Vasya", To = "Petya", Theme = "+2"
        };

        IEmailSender es = new ConsoleEmailSender();

        es.Send(e1);
        es.Send(e2);
        es.Send(e3);
        es.Send(e4);
        es.Send(e5);
        es.Send(e6);

        Console.ReadKey();
    }