Beispiel #1
0
        //发送邮件
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendEmail_Click(object sender, RoutedEventArgs e)
        {
            var vm = sendEmail.DataContext as publicEmailVM;

            //验证控件输入
            ValidationManager.Validate(sendEmail);
            if (vm.ValidationErrors.Count > 0)
            {
                return;
            }

            //发送邮件
            SendEmailReq req = new SendEmailReq();

            req.EmailList = RegexHelper.GetRegexEmail(vm.EmailTo);
            if (req.EmailList.Count > 0)
            {
                DateTimeHelper.GetServerTimeNow(ConstValue.DomainName_SO, p => {
                    req.Title = string.Format(ResSOInternalMemo.Msg_EmailSubject
                                              , m_soSysNo.ToString()
                                              , CPApplication.Current.LoginUser.LoginName
                                              , p);
                    req.Content  = vm.SendContent;
                    req.Language = CPApplication.Current.LanguageCode;
                    new SOFacade(Page).SendEmail(req, (o, args) =>
                    {
                        if (args.FaultsHandle())
                        {
                            return;
                        }
                        Window.Alert(string.Format(ResSOInternalMemo.Msg_SendEmailSuccess, string.Join(";", args.Result.ToArray())));
                    });
                });
            }
        }
        public Respbase SendEmail(SendEmailReq req)
        {
            InvioceFacade facade = new InvioceFacade();

            facade.SendEmail(req);
            return(new Respbase {
                Result = facade.PromptInfo.Result, Message = facade.PromptInfo.Message
            });
        }
Beispiel #3
0
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="req"></param>
        public bool SendEmail(SendEmailReq req)
        {
            if (!IsEmail(req.Email))
            {
                Alert("请输入正确的邮箱");
                return(false);
            }

            var path = System.Web.Hosting.HostingEnvironment.MapPath("/images2" + "http://images2.be.sulink.cn/daren/20191120/0ec6e55e-4b2a-4ace-8682-a71d877a416b.jpg".Replace(AppConfig.ImageBaseUrl, ""));

            SendEmail(req.Email, "相信发票", "这是您申请的电子发票,请在附件查看", "相信官方", path);

            return(true);
        }
Beispiel #4
0
        private void ButtonSend_Click(object sender, RoutedEventArgs e)
        {
            List <ValidationEntity> ValidationForMessage = new List <ValidationEntity>();
            List <ValidationEntity> ValidationForEmail   = new List <ValidationEntity>();
            List <ValidationEntity> ValidationForSubject = new List <ValidationEntity>();

            ValidationForMessage.Add(new ValidationEntity(ValidationEnum.IsNotEmpty, null, ResSendEmail.msg_ContentIsNull));
            ValidationForEmail.Add(new ValidationEntity(ValidationEnum.IsNotEmpty, null, ResSendEmail.msg_AddressIsNull));
            ValidationForSubject.Add(new ValidationEntity(ValidationEnum.IsNotEmpty, null, ResSendEmail.msg_SubjectIsNull));
            //tbSendResults.Text = string.Empty;

            if (!(ValidationHelper.Validation(this.tbEmailAddress, ValidationForEmail) && ValidationHelper.Validation(this.tbEmailContent, ValidationForMessage) && ValidationHelper.Validation(this.tbTitle, ValidationForSubject)))
            {
                return;
            }
            List <string> list = PerHandle(tbEmailAddress.Text, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");

            if (list != null && list.Count > 0)
            {
                SendEmailReq request = new SendEmailReq();
                request.Content     = tbEmailContent.Text.Trim();
                request.Title       = tbTitle.Text.Trim();
                request.EmailList   = list;
                request.CompanyCode = CPApplication.Current.CompanyCode;
                new SMSFacade(CPApplication.Current.CurrentPage).SendEmail(request, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    if (args.Result.Count > 0)
                    {
                        List <string> fomateErrorList = new List <string>();
                        args.Result.ForEach(item => { fomateErrorList.Add(item + ResSendEmail.msg_Fail); });
                        ShowResult(fomateErrorList);
                    }
                    else
                    {
                        CPApplication.Current.CurrentPage.Context.Window.Alert(ResSendEmail.msg_Success);
                        tbEmailContent.Text = string.Empty;
                        tbTitle.Text        = string.Empty;
                    }
                });
            }
            else
            {
                CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("请核对邮件地址是否正确");
            }
        }
Beispiel #5
0
 public void Post([FromBody] SendEmailReq req)
 {
     emailService.Send(req.SmtpType, req.UserName, req.UserPass, req.FromEmail, req.ToEmail, req.SubjectEmail, req.BodyEmail);
 }
Beispiel #6
0
 public void SendSOFinanceInterceptEmail(SendEmailReq request)
 {
     ObjectFactory <SOInterceptAppService> .Instance.SendSOFinanceInterceptEmail(request.soInfo, request.Language);
 }
Beispiel #7
0
 public List <string> SendEmail(SendEmailReq request)
 {
     return(ObjectFactory <SendSMSAndEmailService> .Instance.SendEmail(request.EmailList, request.Title, request.Content, request.CompanyCode));
 }
Beispiel #8
0
 public List <string> SendInternalEmail(SendEmailReq request)
 {
     return(ObjectFactory <SOAppService> .Instance.SendInternalEmail(request.EmailList, request.Title, request.Content, request.Language));
 }
Beispiel #9
0
 /// <summary>
 /// 发送增票拦截邮件
 /// </summary>
 /// <param name="req"></param>
 public void SendSOFinanceInterceptEmail(SendEmailReq req, EventHandler <RestClientEventArgs <dynamic> > callback)
 {
     restClient.Update("/SOService/SO/SendSOFinanceInterceptEmail", req, callback);
 }
Beispiel #10
0
        public void SendEmail(SendEmailReq request, EventHandler <RestClientEventArgs <List <string> > > callback)
        {
            string relativeUrl = "/CustomerService/SMS/SendEmail";

            restClient.Create(relativeUrl, request, callback);
        }
        /// <summary>
        /// 发送订单拦截邮件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendSOInterceptEmail_Click(object sender, RoutedEventArgs e)
        {
            SOInterceptInfoVM orderEmailInfoVM   = new SOInterceptInfoVM();
            SOInterceptInfoVM financeEmailInfoVM = new SOInterceptInfoVM();

            orderEmailInfoVM.EmailAddress            = this.txtEmailAddresse.Text;
            orderEmailInfoVM.CCEmailAddress          = this.txtCCEmailAddress.Text;
            financeEmailInfoVM.FinanceEmailAddress   = this.txtFinanceEmailAddress.Text;
            financeEmailInfoVM.FinanceCCEmailAddress = this.txtFinanceCCEmailAddress.Text;
            if (CurrentSOVM.InvoiceInfoVM.IsVAT == true)
            {
                if (string.IsNullOrEmpty(orderEmailInfoVM.EmailAddress) ||
                    string.IsNullOrEmpty(orderEmailInfoVM.CCEmailAddress) ||
                    string.IsNullOrEmpty(financeEmailInfoVM.FinanceEmailAddress) ||
                    string.IsNullOrEmpty(financeEmailInfoVM.FinanceCCEmailAddress)
                    )
                {
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SaveSOIntercept_Input_Error, MessageType.Error);
                }
                else
                {
                    ValidationManager.Validate(this.gdOrderEmailInfo);
                    if (orderEmailInfoVM.HasValidationErrors && orderEmailInfoVM.ValidationErrors.Count > 0)
                    {
                        return;
                    }
                    ValidationManager.Validate(this.gdFinanceEmailInfo);
                    if (financeEmailInfoVM.HasValidationErrors && financeEmailInfoVM.ValidationErrors.Count > 0)
                    {
                        return;
                    }
                    SOInterceptInfoVM soInterceptInfoVM = new SOInterceptInfoVM();
                    soInterceptInfoVM.EmailAddress          = orderEmailInfoVM.EmailAddress;
                    soInterceptInfoVM.CCEmailAddress        = orderEmailInfoVM.CCEmailAddress;
                    soInterceptInfoVM.FinanceEmailAddress   = financeEmailInfoVM.FinanceEmailAddress;
                    soInterceptInfoVM.FinanceCCEmailAddress = financeEmailInfoVM.FinanceCCEmailAddress;

                    CurrentSOVM.SOInterceptInfoVMList.Add(soInterceptInfoVM);

                    #region 发送订单拦截邮件
                    SendEmailReq reqSOOrderIntercep = new SendEmailReq();
                    reqSOOrderIntercep.soInfo   = SOFacade.ConvertTOSOInfoFromSOVM(CurrentSOVM);
                    reqSOOrderIntercep.Language = CPApplication.Current.LanguageCode;
                    new SOInterceptFacade().SendSOOrderInterceptEmail(reqSOOrderIntercep, (obj, args) =>
                    {
                        if (!args.FaultsHandle())
                        {
                            CloseDialog(new ResultEventArgs
                            {
                                DialogResult = DialogResultType.OK,
                            });
                        }
                    });
                    #endregion
                    #region 发送增票拦截邮件
                    SendEmailReq reqSOFinanceIntercep = new SendEmailReq();
                    reqSOFinanceIntercep.soInfo   = SOFacade.ConvertTOSOInfoFromSOVM(CurrentSOVM);
                    reqSOFinanceIntercep.Language = CPApplication.Current.LanguageCode;
                    new SOInterceptFacade().SendSOFinanceInterceptEmail(reqSOFinanceIntercep, (obj, args) =>
                    {
                        if (!args.FaultsHandle())
                        {
                            CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SendEmail_Sucessful, MessageType.Information);
                            CloseDialog(new ResultEventArgs
                            {
                                DialogResult = DialogResultType.OK,
                            });
                        }
                    });
                    #endregion
                }
            }
            else
            {
                if (string.IsNullOrEmpty(orderEmailInfoVM.EmailAddress) || string.IsNullOrEmpty(orderEmailInfoVM.CCEmailAddress))
                {
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SaveSOIntercept_Input_Error, MessageType.Error);
                }
                else
                {
                    ValidationManager.Validate(this.gdOrderEmailInfo);
                    if (orderEmailInfoVM.HasValidationErrors && orderEmailInfoVM.ValidationErrors.Count > 0)
                    {
                        return;
                    }
                    SOInterceptInfoVM soInterceptInfoVM = new SOInterceptInfoVM();
                    soInterceptInfoVM.EmailAddress   = orderEmailInfoVM.EmailAddress;
                    soInterceptInfoVM.CCEmailAddress = orderEmailInfoVM.CCEmailAddress;
                    CurrentSOVM.SOInterceptInfoVMList.Add(soInterceptInfoVM);
                    #region 发送订单拦截邮件
                    SendEmailReq reqSOOrderIntercep = new SendEmailReq();
                    reqSOOrderIntercep.soInfo   = SOFacade.ConvertTOSOInfoFromSOVM(CurrentSOVM);
                    reqSOOrderIntercep.Language = CPApplication.Current.LanguageCode;
                    new SOInterceptFacade().SendSOOrderInterceptEmail(reqSOOrderIntercep, (obj, args) =>
                    {
                        if (!args.FaultsHandle())
                        {
                            CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SendEmail_Sucessful, MessageType.Information);
                            CloseDialog(new ResultEventArgs
                            {
                                DialogResult = DialogResultType.OK,
                            });
                        }
                    });
                    #endregion
                }
            }
        }