Esempio n. 1
0
        public ActionResult DeleteForm(string keyValue, string type)
        {
            EmailConfigEntity configEntity = emailConfigIBLL.GetCurrentConfig();
            MailAccount       account      = new MailAccount();

            account.POP3Host    = configEntity.F_POP3Host;
            account.POP3Port    = configEntity.F_POP3Port.ToInt();
            account.SMTPHost    = configEntity.F_SMTPHost;
            account.SMTPPort    = configEntity.F_SMTPPort.ToInt();
            account.Account     = configEntity.F_Account;
            account.AccountName = configEntity.F_SenderName;
            account.Password    = configEntity.F_Password;
            account.Ssl         = configEntity.F_Ssl == 1 ? true : false;
            if (type == "1")
            {
                //emailIBLL.DeleteMail(account, keyValue);
                emailSendIBLL.DeleteEntity(keyValue);
            }
            else
            {
                var entity = emailReceiveIBLL.GetReceiveEntity(keyValue);
                emailIBLL.DeleteMail(account, entity.F_MID);
                emailReceiveIBLL.DeleteEntity(keyValue);
            }
            return(Success("删除成功!"));
        }
Esempio n. 2
0
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="receiveCount">主键</param>
        /// <returns></returns>
        public ActionResult SendMail(EmailSendEntity entity)
        {
            EmailConfigEntity configEntity = emailConfigIBLL.GetCurrentConfig();
            MailAccount       account      = new MailAccount();

            account.POP3Host    = configEntity.F_POP3Host;
            account.POP3Port    = configEntity.F_POP3Port.ToInt();
            account.SMTPHost    = configEntity.F_SMTPHost;
            account.SMTPPort    = configEntity.F_SMTPPort.ToInt();
            account.Account     = configEntity.F_Account;
            account.AccountName = configEntity.F_SenderName;
            account.Password    = configEntity.F_Password;
            account.Ssl         = configEntity.F_Ssl == 1 ? true : false;
            MailModel model = new MailModel();

            model.UID   = Guid.NewGuid().ToString();
            entity.F_Id = model.UID;
            model.To    = entity.F_To;
            //model.ToName = entity.F_To;
            model.CC = entity.F_CC;
            //model.CCName = entity.F_CC;
            model.Bcc = entity.F_BCC;
            //model.BccName = entity.F_BCC;
            model.Subject  = entity.F_Subject;
            model.BodyText = entity.F_BodyText;
            //model.Attachment = entity.F_Attachment;
            model.Date = entity.F_Date.ToDate();
            emailIBLL.SendMail(account, model);

            entity.F_Sender     = configEntity.F_Account;
            entity.F_SenderName = configEntity.F_SenderName;
            emailSendIBLL.SaveSendEntity("", entity);
            return(Success("发送成功"));
        }
Esempio n. 3
0
        /// <summary>
        /// 获取邮件
        /// </summary>
        /// <param name="receiveCount">主键</param>
        /// <returns></returns>
        public ActionResult GetMail()
        {
            EmailConfigEntity entity  = emailConfigIBLL.GetCurrentConfig();
            MailAccount       account = new MailAccount();

            account.POP3Host    = entity.F_POP3Host;
            account.POP3Port    = entity.F_POP3Port.ToInt();
            account.SMTPHost    = entity.F_SMTPHost;
            account.SMTPPort    = entity.F_SMTPPort.ToInt();
            account.Account     = entity.F_Account;
            account.AccountName = entity.F_SenderName;
            account.Password    = entity.F_Password;
            account.Ssl         = entity.F_Ssl == 1 ? true : false;

            var receiveCount      = emailReceiveIBLL.GetCount();
            List <MailModel> data = emailIBLL.GetMail(account, receiveCount);

            for (var i = 0; i < data.Count; i++)
            {
                EmailReceiveEntity receiveEntity = new EmailReceiveEntity();
                receiveEntity.F_Sender     = data[i].To;
                receiveEntity.F_SenderName = data[i].ToName;
                receiveEntity.F_MID        = data[i].UID;
                receiveEntity.F_Subject    = data[i].Subject;
                receiveEntity.F_BodyText   = data[i].BodyText;
                //receiveEntity.Attachment = data[i].Attachment;
                receiveEntity.F_Date = data[i].Date;
                emailReceiveIBLL.SaveReceiveEntity("", receiveEntity);
            }
            return(Success(data));
        }
Esempio n. 4
0
 public ActionResult SaveConfigEntity(string keyValue, EmailConfigEntity configEntity)
 {
     emailConfigIBLL.SaveConfigEntity(keyValue, configEntity);
     return(Success("保存成功!"));
 }