예제 #1
0
        public async void SendEmailForPasswordRecovery(string Email)
        {
            ConfigSendEmail config = new ConfigSendEmail(_configSendEmail);

            try
            {
                PasswordRecovery PasswordRecoveryModel = new PasswordRecovery();
                PasswordRecoveryModel.ChangePasswordUrl = CommonContants.ForgotPasswordUrl;
                IMailService       emailService = new MailService();
                IDataStaticService dataService  = new DataStaticService(_env);
                MailTemplate       mailTemplate = dataService.GetMailTemplate(CommonContants.ForgotPassword);
                if (mailTemplate != null)
                {
                    config.Receivers = new List <string>()
                    {
                        Email
                    };                                              //send an email
                    await emailService.SendMail(config, mailTemplate, PasswordRecoveryModel);
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
예제 #2
0
        public async Task HandleAsync(AccountCreatedForEmail e, IMessageContext context)
        {
            //initiator new config for sending email
            ConfigSendEmail config = new ConfigSendEmail(_configSendMail);

            try
            {
                IMailService       emailService = new MailService();
                IDataStaticService dataService  = new DataStaticService(_env);
                MailTemplate       mailTemplate = dataService.GetMailTemplate(CommonContants.AccountCreated);
                if (mailTemplate != null)
                {
                    config.Receivers = new List <string>()
                    {
                        e.Email
                    };                                                //send an email
                    await emailService.SendMail(config, mailTemplate, e);
                }
                Message message = new Message();
                message.ReceiverId = e.Id;
                message.Content    = mailTemplate.Body;
                message.Subject    = mailTemplate.Subject;
                message.Type       = Vacation.common.Enums.MessageType.AccountCreated;
                message.CreateAt   = DateTime.Now;
                _messageService.Create(message);
            }
            catch (Exception ex)
            {
                throw new CustomException(ex.Message, ex.InnerException.Message);
            }
        }
예제 #3
0
        public async Task HandleAsync(RequestForgotPasswordForEmail e, IMessageContext context)
        {
            ConfigSendEmail config = new ConfigSendEmail(_configSendMail);

            try
            {
                IMailService       emailService = new MailService();
                IDataStaticService dataService  = new DataStaticService(_env);
                MailTemplate       mailTemplate = dataService.GetMailTemplate(CommonContants.ForgotPassword);
                if (mailTemplate != null)
                {
                    config.Receivers = new List <string>()
                    {
                        e.Email
                    };                                                //send an email
                    await emailService.SendMail(config, mailTemplate, e);
                }
            }
            catch (Exception ex)
            {
                throw new CustomException("CAN_NOT_SEND_EMAIL", ex.Message);
            }
        }
예제 #4
0
        public async Task HandleAsync(AccountCreatedForEmail e, IMessageContext context)
        {
            //initiator new config for sending email
            ConfigSendEmail config = new ConfigSendEmail(_configSendMail);

            try
            {
                IMailService       emailService = new MailService();
                IDataStaticService dataService  = new DataStaticService(_env);
                MailTemplate       mailTemplate = dataService.GetMailTemplate(CommonContants.AccountCreated);
                if (mailTemplate != null)
                {
                    config.Receivers = new List <string>()
                    {
                        e.Email
                    };                                                //send an email
                    await emailService.SendMail(config, mailTemplate, e);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }