/// <summary>
        /// 得到邮件配置的信息
        /// </summary>
        /// <returns></returns>
        public static EmailMessageSettings GetConfig()
        {
            EmailMessageSettings settings = (EmailMessageSettings)ConfigurationBroker.GetSection("emailMessageSettings");

            ConfigurationExceptionHelper.CheckSectionNotNull(settings, "emailMessageSettings");

            return(settings);
        }
Exemple #2
0
        private static string GetConnectionName()
        {
            string result = EmailMessageSettings.GetConfig().ConnectionName;

            if (result.IsNullOrEmpty())
            {
                result = WorkflowSettings.GetConfig().ConnectionName;
            }

            return(result);
        }
Exemple #3
0
        public static MailAddress ToMailAddress(this EmailAddress ea, bool enableFake = false)
        {
            MailAddress result = null;

            if (ea != null)
            {
                EmailMessageSettings settings = EmailMessageSettings.GetConfig();

                string address = ea.Address;

                if (enableFake && settings.EnableFakeTarget && settings.FakeTarget.IsNotEmpty())
                {
                    address = settings.FakeTarget;
                }

                result = new MailAddress(address, ea.DisplayName);
            }

            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 发送候选的邮件
        /// </summary>
        /// <param name="batchCount"></param>
        public void SendCandidateMessages(int batchCount)
        {
            SmtpParameters sp = EmailMessageSettings.GetConfig().ToSmtpParameters();

            SendCandidateMessages(batchCount, sp);
        }