Exemplo n.º 1
0
        public void SaveEmail()
        {
            if (config.Instance.Site.EnableEmail == false)
            {
                echo("对不起,邮件服务尚未开启,无法发送邮件");
                return;
            }

            MsgInfo msgInfo = validateMsg(true);


            if (ctx.HasErrors)
            {
                run(SendMsg);
                return;
            }

            int sendCount = 0;

            foreach (User user in msgInfo.Users)
            {
                if (isEmailValid(user) == false)
                {
                    continue;
                }
                Boolean sent = confirmEmail.SendEmail(user, msgInfo.Title, msgInfo.Body);
                if (sent)
                {
                    logUser(SiteLogString.SendUserEmail(), user);
                    sendCount++;
                }
            }

            if (sendCount > 0)
            {
                echoRedirect(lang("sentok"), Index);
            }
            else
            {
                echoRedirect(lang("exSentError"), Index);
            }
        }