Example #1
0
        public static void Main(string[] args)
        {
            var fromEmail = ConfigurationManager.AppSettings["google_username"];
            var password = ConfigurationManager.AppSettings["google_password"];

            var mail = new MailMessage(fromEmail,"*****@*****.**");
            mail.Subject = "Test email";
            mail.Body =  "Hello, World!";

            var emailCred = EmailFactory.CrateEmailClient(fromEmail,password, EmailClients.Google);

            var email= new Email(emailCred,mail);

            new EmailSenderService().SendEmail(email);
            Console.WriteLine("email sent");
        }
Example #2
0
        public void SendEmail(IEmail email)
        {
            var emailClient = EmailFactory.CrateEmailClient(email.Client.Username, email.Client.Password, email.Client.GetType());

            emailClient.SendEmail(email.Message);
        }