00001 using System; 00002 using System.Collections.Generic; 00003 using System.Text; 00004 00005 namespace MarekMailSystem2 00006 { 00007 public abstract class EmailSender : IEmailSender 00008 { 00009 00015 public EmailStatus Send(string to, string subject, string body) 00016 { 00017 Email email = new Email(to, subject, body); 00018 Send(email); 00019 return email.SendingStatus; 00020 } 00021 00025 public EmailStatus Send(string from, string to, string subject, string body) 00026 { 00027 Email email = new Email(from, to, subject, body); 00028 Send(email); 00029 return email.SendingStatus; 00030 } 00031 00032 abstract public void Send(Email email); 00033 00039 public EmailStatus SendTemplate(string to, string subject, string body, 00040 Dictionary<string, string> context) 00041 { 00042 Email email = new Email(to, subject, body); 00043 SendTemplate(email, context); 00044 return email.SendingStatus; 00045 } 00046 00050 public EmailStatus SendTemplate(string from, string to, string subject, string body, 00051 Dictionary<string, string> context) 00052 { 00053 Email email = new Email(from, to, subject, body); 00054 SendTemplate(email, context); 00055 return email.SendingStatus; 00056 } 00057 00063 public void SendTemplate(Email template, Dictionary<string, string> context) 00064 { 00065 template.ProcessTemplate(context); 00066 Send(template); 00067 } 00068 00069 } 00070 }