Ejemplo n.º 1
0
        private MailClient GetMailClient(SendEmailParameter header)
        {
            base.VerifyHeader(header);

            using (var context = base.CreateContext())
            {
                var config = context.EmailConfigs.First(t => header.ConfigID == null || t.RowID == header.ConfigID);
                var client = new MailClient();
                var arr    = config.SmtpAuthority.Split(':');
                client.Config(arr[0], arr.Length == 2 ? int.Parse(arr[1]) : 25, config.EnableSsl, config.UserName, config.Password);
                client.SetFrom(config.FromEmail, config.FromDisplayName);
                return(client);
            }
        }