Esempio n. 1
0
        public ReturnValue SendMail(string subject, string textBody, string htmlBody)
        {
            ReturnValue result;

            try
            {
                EmailUtils.SendMail(appConfig.EmailServerSettings.FromEmail,
                                    appConfig.EmailServerSettings.ToEmail,
                                    subject,
                                    appConfig.EmailServerSettings.UseHtmlMail,
                                    appConfig.EmailServerSettings.UseHtmlMail ? htmlBody : textBody,
                                    appConfig.EmailServerSettings.Server,
                                    appConfig.EmailServerSettings.Port,
                                    appConfig.EmailServerSettings.UserName,
                                    appConfig.EmailServerSettings.Password,
                                    appConfig.EmailServerSettings.UseSSL,
                                    appConfig.EmailServerSettings.TimeoutInSec);
                result = ReturnValue.True();
            }
            catch (Exception ex)
            {
                log.Error(ex, $"Unable to send email to - {appConfig.EmailServerSettings.ToEmail}");
                result = ReturnValue.False($"Unable to send email to - {appConfig.EmailServerSettings.ToEmail}");
            }
            return(result);
        }
Esempio n. 2
0
        internal void AddOrder(int customerId, MyShoppingCartVM myCart, WebShopDBContext context)
        {
            DateTime timeStamp = DateTime.Now;

            Order.Add(new Order {
                DateTime = timeStamp, CustomerId = customerId
            });
            SaveChanges();
            int OID = Order.First(o => o.DateTime == timeStamp).Id;

            foreach (var article in myCart.Products)
            {
                for (int i = 0; i < article.NumberOfSameArticle; i++)
                {
                    OrderArticles.Add(new OrderArticles
                    {
                        Oid           = OID,
                        ArticleNumber = $"{article.ArticleNrShort}{article.Size}",
                        Price         = article.Price
                    });
                    SaveChanges();
                }
                int currentQty = Product.First(p => p.ProdArtNr == $"{article.ArticleNrShort}{article.Size}").ProdQty;
                Product.First(p => p.ProdArtNr == $"{article.ArticleNrShort}{article.Size}").ProdQty = currentQty - article.NumberOfSameArticle;
                SaveChanges();
            }
            ;
            User myUser = context.User.First(c => c.Id == customerId);

            EmailUtils.SendOrderConfEmail(OID, context, myUser);
        }
Esempio n. 3
0
        public static Usuario LlenarUsuario(Usuario usuario)
        {
            Console.Write("Correo: ");
            string cor = usuario.Correo = Console.ReadLine();

            if (EmailUtils.IsValidEmail(cor))
            {
                Console.WriteLine("Correo valido");
            }
            else
            {
                Console.Clear();
                LlenarUsuarioInvalido();
            }
            Console.WriteLine("Escriba una contraseña con al menos un numero y minimo 8 caracteres");
            Console.Write("Contraseña: ");
            string c = usuario.Contrasena = Console.ReadLine();

            if (ContraseñaUtils.IsValiPassword(c) == true)
            {
                Console.Clear();
                LlenarUsuarioInvalido();
            }
            usuario.Contrasena = Seguridad.Encriptar(usuario.Contrasena);
            return(usuario);
        }
Esempio n. 4
0
        public virtual ActionResult SubmitFeedback(string name, string email, string feedback, string fromUrl)
        {
            feedback = HttpUtility.HtmlDecode(feedback);

            string emailBody = string.Format(
@"The following feedback was submitted:

Name: {0}
Email: {1}
URL: {2}
Date: {3}

Feedback: 
{4}",
                name,
                email,
                fromUrl,
                DateTime.Now.ToString(),
                feedback);

            EmailUtils emailUtil = new EmailUtils();
            emailUtil.Send("*****@*****.**", "Feedback Submitted", emailBody);

            return View();
        }
        public async Task <IHttpActionResult> PostForgot(JObject value)
        {
            var email = (string)value["email"];

            if (!String.IsNullOrEmpty(email))
            {
                var user = await OwinUserManager.FindByEmailAsync(email.Trim());

                if (user != null)
                {
                    if (await OwinUserManager.IsEmailConfirmedAsync(user.Id))
                    {
                        // Send the link.
                        var token = await OwinUserManager.GeneratePasswordResetTokenAsync(user.Id);

                        var queryString = AccountUtils.GetMailLinkQueryString(token, user.Id);
                        var host        = Request.RequestUri.GetComponents(UriComponents.Host, UriFormat.Unescaped);
                        var link        = "https://" + host + "/account/reset-password?" + queryString;
                        await EmailUtils.SendPasswordResetEmailAsync(email, link);
                    }
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 6
0
        public ActionResult Feedback(FeedbackRequest request)
        {
            EmailUtils.SendFeedbackEmail(request.Name, request.Email, request.Message);

            _productRepository.SaveFeedbackMessage(request);

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
        protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L6MRMS_SEtR_1606 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Base();


            List <ORM_MRS_RUN_MeasurementRun_AccountDownloadCode> downloadCodes = ORM_MRS_RUN_MeasurementRun_AccountDownloadCode.Query.Search(Connection, Transaction, new ORM_MRS_RUN_MeasurementRun_AccountDownloadCode.Query()
            {
                Tenant_RefID         = securityTicket.TenantID,
                IsDeleted            = false,
                MeasurementRun_RefID = Parameter.ReadingSessionId
            });

            foreach (var downloadCode in downloadCodes)
            {
                ORM_CMN_BPT_BusinessParticipant businessParticipant = new ORM_CMN_BPT_BusinessParticipant();
                var bpLoad = businessParticipant.Load(Connection, Transaction, downloadCode.Account_RefID);
                if (bpLoad.Status != FR_Status.Success)
                {
                    continue;
                }

                ORM_CMN_BPT_BusinessParticipant_AccessCode bpAccountCode = ORM_CMN_BPT_BusinessParticipant_AccessCode.Query.Search(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant_AccessCode.Query()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    BusinessParticipant_RefID = businessParticipant.CMN_BPT_BusinessParticipantID
                }).SingleOrDefault();
                if (bpAccountCode == null)
                {
                    continue;
                }

                ORM_CMN_PER_PersonInfo personInfo = new ORM_CMN_PER_PersonInfo();
                var piLoad = personInfo.Load(Connection, Transaction, businessParticipant.IfNaturalPerson_CMN_PER_PersonInfo_RefID);
                if (piLoad.Status != FR_Status.Success)
                {
                    continue;
                }

                //sending email

                string subject = Parameter.EmailSubjectTemplate;
                string body    = String.Format
                                 (
                    Parameter.EmailBodyTemplate,
                    personInfo.FirstName,
                    personInfo.LastName,
                    downloadCode.DownloadCode,
                    bpAccountCode.Code
                                 );
                EmailUtils.SendMail(personInfo.PrimaryEmail, subject, body);
            }

            return(returnValue);

            #endregion UserCode
        }
        public bool IsValid()
        {
            var result = !String.IsNullOrWhiteSpace(Username);

            result &= !String.IsNullOrWhiteSpace(Comment);
            result &= EmailUtils.IsValidAddress(Email);
            result &= !string.IsNullOrWhiteSpace(Password);
            return(result);
        }
Esempio n. 9
0
        public static async Task <MaskDonationModel> CreateMaskDonation(DataContext dataContext, EmailSettings emailSettings, MaskDonationModel maskDonationModel)
        {
            var maskDonation = await MaskDonation.Create(dataContext, maskDonationModel);

            await SendDonationOnItsWayEmail(emailSettings, maskDonation);

            await EmailUtils.SendEmailAsync(emailSettings, EmailMessageType.MaskDonationSubmitted, "Your donation was submitted successfully", "Donation offer received", maskDonationModel.Donor.Email);

            return(maskDonation);
        }
Esempio n. 10
0
        public void EmailSend(OpdExpenseVM OpdExpense)
        {
            var patients = _opdExpensePatientService.GetOpdExpensesPatientAgainstOpdExpenseId(OpdExpense.ID);

            OpdExpense.OpdExpensePatients = patients;
            var images = _opdExpenseImageService.GetOpdExpensesImageAgainstOpdExpenseId(OpdExpense.ID);

            OpdExpense.OpdExpenseImages = images;
            var message = EmailUtils.GetMailMessage(OpdExpense);

            _emailService.SendEmail(message);
        }
Esempio n. 11
0
        private bool CheckForm(UserRegistrationRequestModel user)
        {
            if (ReflectionHelper.HasEmptyOrNullValues(user))
            {
                _dialogService.ShowAlert(EmptyForm, AlertType.Error);
                return(false);
            }

            if (!StringUtils.CheckForEmojis(user.Password) || !StringUtils.CheckForEmojis(user.FirstName) || !StringUtils.CheckForEmojis(user.LastName))
            {
                _dialogService.ShowAlert(DamnEmojis, AlertType.Error, 6f);
                return(false);
            }

            if (!StringUtils.IsLettersOnly(user.FirstName) || !StringUtils.IsLettersOnly(user.LastName))
            {
                _dialogService.ShowAlert(InvalidString, AlertType.Error, 6.5f);
                return(false);
            }

            if (!EmailUtils.IsValidEmail(StringUtils.RemoveWhiteSpaces(user.Email)))
            {
                _dialogService.ShowAlert(InvalidEmail, AlertType.Error);
                return(false);
            }

            if (user.Password.Length < 8)
            {
                _dialogService.ShowAlert(PasswordWeak, AlertType.Error, 6f);
                return(false);
            }

            if (user.Password != FormModelList[4].TextFieldValue)
            {
                _dialogService.ShowAlert(PasswordMatch, AlertType.Error, 3.5f);
                return(false);
            }

            if (user.Phone.Length > 16 || user.Phone.Length < 8)
            {
                _dialogService.ShowAlert(AlertPhoneNumber, AlertType.Error, 3.5f);
                return(false);
            }

            if (!_userAgreed)
            {
                _dialogService.ShowAlert(UserAgreement, AlertType.Error);
                return(false);
            }

            return(true);
        }
Esempio n. 12
0
        public ActionResult Registration(RegistrationRequest request)
        {
            var userId = _userRepository.AddUser(request);

            if (userId == Guid.Empty)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Conflict));
            }

            EmailUtils.SendRegistrationEmail(request.FullName, userId, request.Email);

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 13
0
        private void SendRegistrationEmail(string emailAddress, string firstName, string lastName, string key)
        {
            var emailModel = new KeyedEmailModel
            {
                EmailAddress = emailAddress,
                FirstName    = firstName,
                LastName     = lastName,
                Key          = key
            };

            var message = ControllerContext.Render("_AddEmailPartial", new ViewDataDictionary(emailModel)).ToString();

            EmailUtils.Send(message, emailAddress, firstName, lastName, subject: ControllerRes.Account.Email_SubjectUserRegistration);
        }
Esempio n. 14
0
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            ValidationResult validationResult = new ValidationResult(false, "Adres nieprawidłowy");

            if (value != null)
            {
                string stringValue = value as string;
                if (EmailUtils.IsValidAddress(stringValue))
                {
                    validationResult = ValidationResult.ValidResult;
                }
            }
            return(validationResult);
        }
        public ActionResult Compose(ComposeMail newMessage)
        {
            if (Request["Send"] != null)
            {
                if (ModelState.IsValid)
                {
                    // actually send it this time
                    try
                    {
                        EmailUtils.Send(newMessage.MailMessage);
                    }
                    catch
                    {
                        // there was an error sending the message
                        throw new HttpException(500, Support.Error_Sending);
                    }

                    try
                    {
                        if (!string.IsNullOrEmpty(newMessage.Uid))
                        {
                            using (var imap = EnsureConnection())
                            {
                                imap.SelectMailbox("Sent Items");
                                imap.AppendMail(newMessage.MailMessage);
                                imap.SelectMailbox("Drafts");
                                imap.DeleteMessage(newMessage.Uid);
                            }
                        }
                    }
                    catch
                    {
                        throw new HttpException(417, Support.Error_Copying);
                    }
                    return(new EmptyResult());
                }
                else
                {
                    Response.StatusCode             = 417;
                    Response.TrySkipIisCustomErrors = true;

                    return(PartialView(newMessage));
                }
            }
            else
            {
                newMessage.Uid = Draft(newMessage.MailMessage, newMessage.Uid).Uid;
                return(Json(newMessage));
            }
        }
Esempio n. 16
0
        public void monitorUrl()
        {
            String result = HttpUtils.postRequest(url, "", null);

            if ("success".Equals(result))
            {
                button.BackColor = Color.LimeGreen;
            }
            else
            {
                button.BackColor = Color.OrangeRed;
                if (!"".Equals(warn))
                {
                    String[] warnArray = warn.Split(";");
                    for (int index = 0; index < warnArray.Length; index++)
                    {
                        String warnSingle = warnArray[index];
                        if (warnSingle.Contains("qyapi.weixin.qq.com"))
                        {
                            try
                            {
                                // 企业微信机器人地址
                                WorkWxSendMessage workWxSendMessage = new WorkWxSendMessage();
                                workWxSendMessage.msgtype = WorkWxSendMessage.MSGTYPE_TEXT;
                                WorkWxSendMessage.Text text = new WorkWxSendMessage.Text();
                                text.content           = title + "服务异常!";
                                workWxSendMessage.text = text;
                                String robotSendContentJson = JsonConvert.SerializeObject(workWxSendMessage);
                                LogUtils.writeLog(robotSendContentJson);
                                HttpUtils.postRequest(warn, robotSendContentJson, HttpUtils.CONTENT_TYPE_APPLICATION_JSON);
                            }
                            catch (Exception e)
                            {
                                LogUtils.writeLog(e.StackTrace);
                            }
                        }
                        else if (warnSingle.Contains("@163.com") || warnSingle.Contains("@qq.com") || warnSingle.Contains("@163.com"))
                        {
                            // 邮箱
                            String     emailBody = title + "服务无法访问!";
                            EmailUtils emailUtis = new EmailUtils(Config.emailServer, warnSingle, Config.fromEmail, "服务监控", emailBody, Config.username, Config.password, Config.emailPort, true, true);
                            emailUtis.Send();
                        }
                        else
                        {
                        }
                    }
                }
            }
        }
Esempio n. 17
0
        public async Task <ActionResult> CollectFine(SpeedingViolation speedingViolation, [FromServices] DaprClient daprClient)
        // Replace the SpeedingViolation with a JsonDocument parameter. Doing so will enable Dapr pub/sub messaging.
        //public async Task<ActionResult> CollectFine([FromBody] System.Text.Json.JsonDocument cloudevent)
        {
            // Remove CloudEvent parsing code when using ASP.NET Core Dapr client
            // // Extract SpeedingViolation data from the cloudevent parameter and assign to SpeedingViolation type.
            // var data = cloudevent.RootElement.GetProperty("data");

            // // Transform raw data into a SpeedingViolation object
            // var speedingViolation = new SpeedingViolation
            // {
            //     VehicleId = data.GetProperty("vehicleId").GetString(),
            //     RoadId = data.GetProperty("roadId").GetString(),
            //     Timestamp = data.GetProperty("timestamp").GetDateTime(),
            //     ViolationInKmh = data.GetProperty("violationInKmh").GetInt32()
            // };

            decimal fine = _fineCalculator.CalculateFine(_fineCalculatorLicenseKey, speedingViolation.ViolationInKmh);

            // get owner info
            var vehicleInfo = await _vehicleRegistrationService.GetVehicleInfo(speedingViolation.VehicleId);

            // log fine
            string fineString = fine == 0 ? "tbd by the prosecutor" : $"{fine} Euro";

            _logger.LogInformation($"Sent speeding ticket to {vehicleInfo.OwnerName}. " +
                                   $"Road: {speedingViolation.RoadId}, Licensenumber: {speedingViolation.VehicleId}, " +
                                   $"Vehicle: {vehicleInfo.Brand} {vehicleInfo.Model}, " +
                                   $"Violation: {speedingViolation.ViolationInKmh} Km/h, Fine: {fineString}, " +
                                   $"On: {speedingViolation.Timestamp.ToString("dd-MM-yyyy")} " +
                                   $"at {speedingViolation.Timestamp.ToString("hh:mm:ss")}.");

            // send fine by email
            // Create email body with custom EmailUtility class
            var body = EmailUtils.CreateEmailBody(speedingViolation, vehicleInfo, fineString);

            // Specify email metadata
            var metadata = new Dictionary <string, string>
            {
                ["emailFrom"] = "*****@*****.**",
                ["emailTo"]   = vehicleInfo.OwnerEmail,
                ["subject"]   = $"Speeding violation on the {speedingViolation.RoadId}"
            };

            // Call email server with Dapr output binding
            await daprClient.InvokeBindingAsync("sendmail", "create", body, metadata);

            return(Ok());
        }
Esempio n. 18
0
        public Organization FindOrganizationByEmailAddr(string emailAddr)
        {
            Organization organization = null;

            // Guard block
            if (!string.IsNullOrEmpty(emailAddr))
            {
                string domain = EmailUtils.GetDomainFromEmailAddr(emailAddr).Trim().ToLower();
                if (!string.IsNullOrEmpty(domain) && !EmailUtils.IsEmailHostCommonProvider(domain))
                {
                    organization = db.Organizations.FirstOrDefault(o => o.EmailHost.Equals(domain));
                }
            }
            return(organization);
        }
Esempio n. 19
0
        /// <summary>
        /// Generates the e-mail using the extension method ControllerContext.Render()
        /// </summary>
        /// <param name="emailAddress">The e-mail address to send the reset email to.</param>
        /// <param name="key">The unique secret key sent only to that e-mail address that verifies it reached the right person and they can reset their account.</param>
        /// <param name="firstName">First name of the user.</param>
        /// <param name="lastName">Last name of the user.</param>
        private void SendResetEmail(string emailAddress, string key, string firstName = null, string lastName = null)
        {
            // Send email for password reset completion.
            var emailModel = new KeyedEmailModel
            {
                EmailAddress = emailAddress,
                FirstName    = firstName,
                LastName     = lastName,
                Key          = key
            };

            var message = ControllerContext.Render("_ResetEmailPartial", new ViewDataDictionary(emailModel)).ToString();

            EmailUtils.Send(message, emailAddress, firstName, lastName, subject: Account.Email_SubjectPasswordReset);
        }
Esempio n. 20
0
        public ActionResult MakeOrder(MakeOrderRequest request)
        {
            var userId = CurrentUser.UserId;

            if (userId == Guid.Empty)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var order = _orderRepository.MakeOrder(userId, request);

            EmailUtils.SendUserOrderEmail(CurrentUser.FullName, CurrentUser.Email, order);
            EmailUtils.SendAdminOrderEmail();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 21
0
        private bool ValidateInputs()
        {
            if (usernameTextBox.Text.Trim().Length < 4)
            {
                OnValidating("* Username must be a least 4 chars");
                return(false);
            }

            if (userPasswordTextBox.Text.Trim().Length < 6)
            {
                OnValidating("* StoredPassword must be a least 6 chars");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(userCinTextBox.Text))
            {
                OnValidating("* CIN is required");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(userFirstNameTextBox.Text))
            {
                OnValidating("* First Name is required");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(userFirstNameTextBox.Text))
            {
                OnValidating("* Last Name is required");
                return(false);
            }

            if (!EmailUtils.IsValidEmail(userEmailTextBox.Text))
            {
                OnValidating("* Email address not valid");
                return(false);
            }

            if (userPhoneTextBox.Text.Trim().Length != 14)
            {
                OnValidating("*Phone number is not valid");
                return(false);
            }


            return(true);
        }
Esempio n. 22
0
        public ProfessorValidador(IUsuarioServico usuarioServico, IEscolaridadeServico escolaridadeServico, IModalidadeEnsinoServico modalidadeServico, IResourceLocalizer resource)
        {
            _resource            = resource;
            _usuarioServico      = usuarioServico;
            _escolaridadeServico = escolaridadeServico;
            _modalidadeServico   = modalidadeServico;

            RuleFor(x => x.UsuarioId)
            .NotNull()
            .NotEmpty()
            .WithMessage(string.Format(_resource.GetString("FIELD_REQUIRED"), "Id do usuário"))
            .Must(x => _usuarioServico.ObterPorId(x) != null)
            .WithMessage(string.Format(_resource.GetString("INEXISTENT_ID"), "Usuário"));

            RuleFor(x => x.EscolaridaPubAlvoId)
            .NotNull()
            .NotEmpty()
            .WithMessage(string.Format(_resource.GetString("FIELD_REQUIRED"), "Id da escolaridade do público alvo"))
            .Must(x => _escolaridadeServico.ObterEscolaridadePorId(x) != null)
            .WithMessage(string.Format(_resource.GetString("INEXISTENT_ID"), "Modelo de escolaridade"));

            RuleFor(x => x.ModalidadeEnsinoId)
            .NotNull()
            .NotEmpty()
            .WithMessage(string.Format(_resource.GetString("FIELD_REQUIRED"), "Id da Modalidade de ensino"))
            .Must(x => _modalidadeServico.ObterModalidadePorId(x) != null)
            .WithMessage(string.Format(_resource.GetString("INEXISTENT_ID"), "Modelo de modalidade de ensino"));

            RuleFor(x => x.Email)
            .NotNull()
            .NotEmpty()
            .WithMessage(string.Format(_resource.GetString("FIELD_REQUIRED"), "Email"))
            .Must(x => EmailUtils.EmailValido(x))
            .WithMessage(string.Format(_resource.GetString("FIELD_FORMAT"), "Email"));

            RuleFor(x => x.Senha)
            .NotNull()
            .NotEmpty()
            .WithMessage(string.Format(_resource.GetString("FIELD_REQUIRED"), "Senha"));

            RuleFor(x => x.ValorHora)
            .NotNull()
            .NotEmpty()
            .WithMessage(string.Format(_resource.GetString("FIELD_REQUIRED"), "Valor por hora/aula"))
            .Must(x => x >= 10 && x <= 200)
            .WithMessage(string.Format(_resource.GetString("VALUE_HOUR_RULE"), "10", "200"));
        }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Edit")
         {
             Response.Redirect("edit.aspx?ID=" + gID.ToString());
         }
         else if (e.CommandName == "Duplicate")
         {
             Response.Redirect("edit.aspx?DuplicateID=" + gID.ToString());
         }
         else if (e.CommandName == "Delete")
         {
             SqlProcs.spCAMPAIGNS_Delete(gID);
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "SendTest")
         {
             SqlProcs.spCAMPAIGNS_SendEmail(gID, true);
             // 12/22/2007 Paul.  Send all queued emails, but include the date so that only these will get sent.
             EmailUtils.SendQueued(Application, Guid.Empty, gID, false);
             Response.Redirect("view.aspx?ID=" + gID.ToString());
         }
         else if (e.CommandName == "SendEmail")
         {
             SqlProcs.spCAMPAIGNS_SendEmail(gID, false);
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "MailMerge")
         {
             // 08/12/2007 Paul.  Mail merge is not supported yet.
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "Cancel")
         {
             Response.Redirect("default.aspx");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         ctlDetailButtons.ErrorText = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx");
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spEMAILMAN_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
         else if (e.CommandName == "SendQueued")
         {
             // 12/20/2007 Paul.  Send all queued emails, regardless of send date.
             EmailUtils.SendQueued(Application, Guid.Empty, Guid.Empty, true);
             Response.Redirect("default.aspx");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
Esempio n. 25
0
        private static async Task SendDonationOnItsWayEmail(EmailSettings emailSettings, MaskDonationModel maskDonationModel)
        {
            var recipient = maskDonationModel.Request.Recipient;
            var donor     = maskDonationModel.Donor;

            var updateStatusLink = "midwesthelps.com/donationStatus";
            var donorCompany     = !string.IsNullOrEmpty(donor.Company) ? $"<br />{donor.Company}" : "";

            var htmlMessageSB = new StringBuilder(await EmailUtils.GetEmailHTMLTemplate(EmailMessageType.DonationOnItsWay));

            htmlMessageSB.Replace("{DonorName}", donor.Name)
            .Replace("{DonorEmail}", donor.Email)
            .Replace("{DonorPhone}", donor.Phone)
            .Replace("{DonorCompany}", donorCompany)
            .Replace("{MaskDetails}", getMaskDetailsForEmail(maskDonationModel.Donation))
            .Replace("{Status}", EnumUtils.GetName(DonationStatus.Received))
            .Replace("{Id}", maskDonationModel.Id.ToString())
            .Replace("{ReceivedDonationLink}", updateStatusLink);
            await EmailUtils.SendEmailAsync(emailSettings, htmlMessageSB.ToString(), $"{maskDonationModel.Donor.Name} has a donation!", "You got a donation offer", recipient.Email);
        }
Esempio n. 26
0
    private void EnviarMensajeAdministradores(string NuevoUsuario)
    {
        //1.-Destino del mensaje
        System.Net.Mail.MailAddressCollection MisDestinos = new System.Net.Mail.MailAddressCollection();
        string[] usersInRole = Roles.GetUsersInRole("administrador");
        foreach (string userid in usersInRole)
        {
            MembershipUser user = Membership.GetUser((object)userid, false);
            if (user != null)
            {
                MisDestinos.Add(new System.Net.Mail.MailAddress(user.Email));
            }
        }

        //2.-Cuerpo del mensaje
        string sMensaje = "Le informo que el usuario " + NuevoUsuario + " ha solicitado su alta web en el portal de datos DropKeys. ";

        //3.-Envio del mensaje
        EmailUtils.SendMessageEmail(MisDestinos, "New user", sMensaje);
    }
Esempio n. 27
0
        public static bool SendMail(string strFromDisplayName, string strReciveMail, string strSubject, string strMailBody, bool boolIsSSL, out string strResult)
        {
            EmailUtils emailUtils = new EmailUtils();

            emailUtils.FromMail     = ConfigProvider.Configs.ServMailAccount;
            emailUtils.ToMail       = strReciveMail;
            emailUtils.SmtpServer   = ConfigProvider.Configs.ServMailSMTP;
            emailUtils.MailUserName = ConfigProvider.Configs.ServMailUserName;
            emailUtils.MailPassWord = ConfigProvider.Configs.ServMailUserPwd;
            emailUtils.MailFormat   = EmailType.html;
            emailUtils.Subject      = strSubject;
            emailUtils.Body         = strMailBody;
            emailUtils.IsSSL        = ConfigProvider.Configs.ServMailIsSSL;

            if (!string.IsNullOrEmpty(strFromDisplayName))
            {
                emailUtils.FromDisplayName = ConfigProvider.Configs.SiteName;
            }
            return(emailUtils.SendEmail(out strResult));
        }
Esempio n. 28
0
        public void AddUser(JObject user, string uID)
        {
            string test = (string)user["FirstName"];

            User.Add(new User
            {
                Uid         = uID,
                Firstname   = (string)user["FirstName"],
                Lastname    = (string)user["LastName"],
                Phonenumber = (string)user["PhoneNumber"],
                Addressline = (string)user["AddressLine"],
                Zipcode     = (string)user["ZipCode"],
                City        = (string)user["City"],
                Email       = (string)user["Email"]
            });
            SaveChanges();

            User tempUser = User.First(u => u.Uid == uID);

            EmailUtils.SendRegistrationConfEmail(tempUser);
        }
Esempio n. 29
0
        public string GetError()
        {
            ErrorLog = String.Empty;
            if (String.IsNullOrWhiteSpace(Username))
            {
                ErrorLog += "Dane osobowe nie zostały ustawione.\n";
            }
            if (String.IsNullOrWhiteSpace(Comment))
            {
                ErrorLog += "Komentarz nie został ustawiony" + System.Environment.NewLine;
            }
            if (!EmailUtils.IsValidAddress(Email))
            {
                ErrorLog += "E-mail jest nieustawiony lub jest niepoprawny." + System.Environment.NewLine;
            }

            if (string.IsNullOrWhiteSpace(Password))
            {
                ErrorLog += "Hasło jest nieustawione." + System.Environment.NewLine;
            }
            return(ErrorLog);
        }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Delete")
         {
             SqlProcs.spEMAILMAN_Delete(gID);
             // 12/20/2007 Paul.  Use RegisterStartupScript so that the rest of the page is rendered before the code is run.
             Page.ClientScript.RegisterStartupScript(System.Type.GetType("System.String"), "UpdateParent", "<script type=\"text/javascript\">UpdateParent();</script>");
         }
         else if (e.CommandName == "Send")
         {
             EmailUtils.SendQueued(Application, gID, Guid.Empty, true);
             Page.ClientScript.RegisterStartupScript(System.Type.GetType("System.String"), "UpdateParent", "<script type=\"text/javascript\">UpdateParent();</script>");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
Esempio n. 31
0
        public string EsqueciSenha(string email)
        {
            var ret           = String.Empty;
            var dataInterface = new DataInterface();
            var retLogin      = dataInterface.GetLogin(email);

            if (retLogin.Sucesso)
            {
                var user       = (UsuarioModel)retLogin.Retorno;
                var corpoEmail = $"Olá {user.Nome}! <br/>" +
                                 "<p>Se você está recebendo este E-Mail é porque solicitou sua senha no sistema Anjo Azul <br/><br/>" +
                                 $"Seu usuário para acesso é: {user.EMail}<br/>" +
                                 $"Sua senha para acesso é: {user.Senha}<br/>" +
                                 "<br/>" +
                                 "Att.<br/>Sistema Anjo Azul!";
                return(EmailUtils.SendMail("Recuperação de Senha - Anjo Azul", corpoEmail, email));
            }
            else
            {
                return("Usuário não encontrado em nossa base de dados");
            }
        }