Exemplo n.º 1
0
        private static string CreateEmailBodyForEmailChangeConfirmation()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (ConfigUtil.WebEnvironment != "prod")
            {
                sb.AppendFormat("-----------TEST Confirm Your Email from DEV site------------"); sb.AddNewHtmlLines(2);
                sb.AppendFormat("-----------Created from DEV environment: {0}------------", ConfigUtil.WebEnvironment); sb.AddNewHtmlLines(2);;
            }
            sb.Append("Hello,");
            sb.AddNewHtmlLines(3);
            sb.Append("This email is to confirm that your Email of shipnpr.shiptalk.org account has been changed successfully.");
            sb.AddNewHtmlLines(2);
            sb.Append("If you did not change your Email, please contact SHIP NPR Help Desk immediately.");
            sb.AddNewHtmlLines(3);
            sb.Append("Thank you,");
            sb.AddNewHtmlLine();
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append("<a href='https://shipnpr.shiptalk.org'>https://shipnpr.shiptalk.org</a>");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLines(5);

            return(sb.ToString());
        }
Exemplo n.º 2
0
        private static string CreateEmailBodyForRegistrationNotification(UserProfile userProfile, UserAccount userAccount)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (ConfigUtil.WebEnvironment != "prod")
            {
                sb.AppendFormat("-----------TEST User Registration from DEV site------------"); sb.Append(AddLines(2));
                sb.AppendFormat("-----------Created from DEV environment: {0}------------", ConfigUtil.WebEnvironment); sb.Append(AddLines(2));
            }
            sb.AppendFormat("-----------New User Registration Notification------------"); sb.Append(AddLines(2));


            sb.Append("A new user has registered at shipnpr.shiptalk.org."); sb.Append(AddLine());
            sb.Append("The account is currently inactive and awaiting your approval.");
            sb.Append(AddLines(3));


            sb.Append("Here is a summary of the registration:"); sb.Append(AddLines(2));

            sb.Append("<strong>Personal Information:</strong>"); sb.Append(AddLine());
            sb.AppendFormat("Name: {0}", userProfile.FirstName); sb.Append(AddLine());
            sb.AppendFormat("Middle Name: {0}", userProfile.MiddleName); sb.Append(AddLine());
            sb.AppendFormat("Last Name: {0}", userProfile.LastName); sb.Append(AddLine());
            sb.AppendFormat("Nick Name: {0}", userProfile.NickName); sb.Append(AddLines(2));

            sb.Append("<strong>Contact Information:</strong>"); sb.Append(AddLine());
            sb.AppendFormat("Primary Phone: {0}", userProfile.PrimaryPhone); sb.Append(AddLine());
            sb.AppendFormat("Primary Email: {0}", userAccount.PrimaryEmail); sb.Append(AddLine());
            sb.AppendFormat("Secondary Email: {0}", userProfile.SecondaryEmail); sb.Append(AddLine());
            sb.AppendFormat("Primary Phone: {0}", userProfile.PrimaryPhone); sb.Append(AddLines(2));

            sb.Append("<strong>Requested Account Information:</strong>"); sb.Append(AddLine());
            sb.AppendFormat("State: {0}", State.GetStateName(userAccount.StateFIPS)); sb.Append(AddLine());

            string role = userAccount.ScopeId.ToEnumObject <Scope>().Description() + (userAccount.IsAdmin ? " Admin access" : " User access");

            sb.AppendFormat("Role: {0}", role); sb.Append(AddLines(3));

            //Need to add User Descriptor and Regional Access profile by verifying what role or agency was selected.

            sb.Append("Please login to https://SHIPNPR.SHIPTalk.org to approve or deny this registration request.");
            sb.Append(AddLines(2));
            sb.Append("Thank you,");
            sb.Append(AddLine());
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.EmailOfResourceCenter);
            sb.AddNewHtmlLines(5);


            return(sb.ToString());
        }
Exemplo n.º 3
0
        private string CreateEmailBodyForResetPassword()
        {
            Guid VerificationToken = GetGuidForEmailReset();

            string sVerificationToken = string.Empty;

            if (VerificationToken == Guid.Empty)
            {
                throw new ShiptalkException("Unable to obtain Token (Guid) for Email Reset process", true, "An error occured in the password reset process. Please contact support if the problem persists.");
            }
            else
            {
                sVerificationToken = VerificationToken.ToString();
            }

            string linkFormat = "<a href='" + ConfigUtil.PasswordResetUrl + "?prt={0}'>Follow this link</a>";
            string ResetLink  = string.Format(linkFormat, (EmailAddress + sVerificationToken));
            string textlink   = ConfigUtil.PasswordResetUrl + "?prt={0}";

            textlink = string.Format(textlink, (EmailAddress + sVerificationToken));

            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            if (ConfigUtil.WebEnvironment != "prod")
            {
                sb.AppendFormat("-----------TEST Reset Your Password from DEV site------------"); sb.AddNewHtmlLines(2);
                sb.AppendFormat("-----------Created from DEV environment: {0}------------", ConfigUtil.WebEnvironment); sb.AddNewHtmlLines(2);;
            }
            sb.Append("Hello,");
            sb.AddNewHtmlLines(2);
            sb.Append("A request to reset your password was made at shipnpr.shiptalk.org.");
            sb.AddNewHtmlLine();
            sb.Append("If you did not request your password reset, please disregard this message.");
            sb.AddNewHtmlLines(2);


            sb.Append(ResetLink);//Follow this link ahref
            sb.Append(" to reset your password. If you have difficulties accessing the link, copy and paste the link below into your browser’s address bar to verify your email address.");
            sb.AddNewHtmlLines(2);
            sb.Append(textlink);
            sb.AddNewHtmlLines(3);
            sb.Append("Thank you,");
            sb.AddNewHtmlLine();
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append("<a href='https://shipnpr.shiptalk.org'>https://shipnpr.shiptalk.org</a>");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLines(5);

            return(sb.ToString());
        }
Exemplo n.º 4
0
        private static bool SendApprovedEmail(int UserId)
        {
            UserViewData userView = UserBLL.GetUser(UserId);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.AppendFormat("Dear {0},", userView.FullName);
            sb.AddNewHtmlLines(2);
            sb.Append("Your request to shipnpr.shiptalk.org account has been approved.");
            sb.AddNewHtmlLines(2);
            sb.Append("You may login anytime using your registered information.");
            sb.AddNewHtmlLines(2);

            sb.Append("If you do not know your new SHIPtalk password, you can reset it by going to <a href='https://shipnpr.shiptalk.org'>https://shipnpr.shiptalk.org</a> and clicking 'Forgot password?' in the left of the screen. Follow the instructions to have the password reset instructions emailed to you. Once you reset your password, you should be able to log in to the website with your username (email address) and new password.");
            sb.AddNewHtmlLines(2);

            sb.Append("Submit your entire email address so the instructions to reset your password will be emailed to you.");
            sb.AddNewHtmlLine();

            sb.Append("Thank you,");
            sb.AddNewHtmlLine();
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append("<a href='https://shipnpr.shiptalk.org'>https://shipnpr.shiptalk.org</a>");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLines(5);



            ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);

            mailMessage.ToList.Add(userView.PrimaryEmail);
            mailMessage.Subject = "Your shipnpr.shiptalk.org account is approved";

            mailMessage.Body = sb.ToString();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);


            try
            {
                mail.SendMail();
                return(true);
            }
            catch { }

            return(false);
        }
Exemplo n.º 5
0
        private string CreateEmailBodyForPasswordCanNotBeChanged()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("You already changed your password. You are allowed to change your password once in a day");
            sb.AddNewHtmlLines(2);
            sb.Append("Contact help desk to unlock, verify your identity, and change password.");

            sb.AddNewHtmlLines(3);
            sb.Append("Thank you,");
            sb.AddNewHtmlLine();
            sb.Append("SHIPNPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append("<a href='https://shipnpr.shiptalk.org'>https://shipnpr.shiptalk.org</a>");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLines(5);

            return(sb.ToString());
        }
Exemplo n.º 6
0
        private static bool SendUserAboutEmailChangeRequest(int UserId, out string ErrorMessage)
        {
            ErrorMessage = string.Empty;
            UserViewData UserRegistrationData = UserBLL.GetUser(UserId);

            ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);

            mailMessage.ToList.Add(UserRegistrationData.PrimaryEmail);
            mailMessage.Subject = "Your shipnpr.shiptalk.org Email Change request";

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendFormat("Dear {0} {1},", UserRegistrationData.FirstName.ToCamelCasing(), UserRegistrationData.LastName.ToCamelCasing());
            sb.AddNewHtmlLines(2);
            sb.Append("You have requested to change your Email at shipnpr.shiptalk.org.");
            sb.AddNewHtmlLines(2);
            sb.Append("The Verification email has been sent to your new email id. Please check the email and follow the instructions to verify your email address. You can continue using Shipnpr website with your old email id until the new email id is being verified.");
            sb.AddNewHtmlLines(2);
            sb.Append("If you have not requested for Email change, please contact SHIP NPR Help Desk at 1-800-253-7154, option 1 or <a href='mailto:[email protected]'>[email protected]</a> immediately.");
            sb.AddNewHtmlLines(3);
            sb.Append("Thank you,");
            sb.AddNewHtmlLines(2);
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.EmailOfResourceCenter);
            sb.AddNewHtmlLines(5);

            mailMessage.Body = sb.ToString();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            if (!mail.SendMail())
            {
                ErrorMessage = string.Format("An error occured while sending email to {0}.", UserRegistrationData.PrimaryEmail);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 7
0
        private static bool SendDisapproveEmail(UserViewData UserData)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.AppendFormat("Dear {0},", UserData.FullName);
            sb.AddNewHtmlLines(2);
            sb.Append("Your request to shipnpr.shiptalk.org.account has been denied by the administrator.");
            sb.AddNewHtmlLines(2);
            sb.Append("Thank you,");
            sb.AddNewHtmlLine();
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append("<a href='https://shipnpr.shiptalk.org'>https://shipnpr.shiptalk.org</a>");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLines(5);


            ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);

            mailMessage.ToList.Add(UserData.PrimaryEmail);
            mailMessage.Subject = "Your shipnpr.shiptalk.org account is denied.";

            mailMessage.Body = sb.ToString();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);


            try
            {
                mail.SendMail();
                return(true);
            }
            catch { }

            return(false);
        }
Exemplo n.º 8
0
        private static bool SendAddUserVerificationEmail(int UserId, out string ErrorMessage)
        {
            ErrorMessage = string.Empty;

            UserViewData UserRegistrationData = UserBLL.GetUser(UserId);
            string       EmailAddress         = UserRegistrationData.PrimaryEmail;
            //UserViewData RegisteredByUserInfo = UserBLL.GetUser(RegisteredByUserId);

            Guid   VerificationToken  = UserBLL.GetEmailVerificationTokenForUser(UserId);
            string sVerificationToken = string.Empty;

            if (VerificationToken == Guid.Empty)
            {
                ErrorMessage = "An error occured while preparing content for email address verification procedure. Please contact support if this issue persists.";
                return(false);
            }
            else
            {
                sVerificationToken = VerificationToken.ToString();
            }

            string linkFormat       = "<a href='" + ConfigUtil.EmailConfirmationUrl + "?evt={0}'>Follow this link</a>";
            string confirmLinkParam = EmailAddress + sVerificationToken;
            string confirmLink      = string.Format(linkFormat, confirmLinkParam);
            string textlink         = ConfigUtil.EmailConfirmationUrl + "?evt={0}";

            textlink = string.Format(textlink, confirmLinkParam);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            if (ConfigUtil.WebEnvironment != "prod")
            {
                sb.AppendFormat("-----------TEST  User Account Registration DEV site------------"); sb.AddNewHtmlLines(2);
                sb.AppendFormat("-----------Created from DEV environment: {0}------------", ConfigUtil.WebEnvironment); sb.AddNewHtmlLines(2);;
            }
            sb.AppendFormat("Dear {0} {1},", UserRegistrationData.FirstName.ToCamelCasing(), UserRegistrationData.LastName.ToCamelCasing());
            sb.AddNewHtmlLines(2);
            sb.Append("A new user account has been registered for you at the shipnpr.shiptalk.org.");
            sb.AddNewHtmlLines(2);
            sb.AppendFormat(confirmLink);
            sb.Append(" to verify your email address. If you have difficulties accessing the link, copy and paste the link below to your browser to verify your email address.");

            sb.AddNewHtmlLines(2);
            sb.Append(textlink);
            sb.AddNewHtmlLines(3);
            sb.Append("You will be able to login to the shipnpr.shiptalk.org upon successful verification of the email using the above link.");
            //sb.AddNewHtmlLine();
            //sb.AppendFormat("If you require assistance, please contact {0} at {1}.", RegisteredByUserInfo.FullName, RegisteredByUserInfo.PrimaryEmail);
            sb.AddNewHtmlLines(2);
            sb.Append("Thank you,");
            sb.AddNewHtmlLine();
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLines(5);


            ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);

            mailMessage.ToList.Add(EmailAddress);

            if (ConfigUtil.WebEnvironment != "prod")
            {
                mailMessage.Subject = "Welcome to shipnpr.shiptalk.org!(" + ConfigUtil.WebEnvironment + ")";
            }
            else
            {
                mailMessage.Subject = "Welcome to shipnpr.shiptalk.org!";
            }

            mailMessage.Body = sb.ToString();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            if (!mail.SendMail())
            {
                ErrorMessage = string.Format("An error occured while sending email to {0}.", UserRegistrationData.PrimaryEmail);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 9
0
        private static bool SendUserRegistrationVerificationEmail(int UserId, out string ErrorMessage)
        {
            ErrorMessage = string.Empty;
            UserViewData UserRegistrationData = UserBLL.GetUser(UserId);

            ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);

            mailMessage.ToList.Add(UserRegistrationData.PrimaryEmail);

            if (ConfigUtil.WebEnvironment != "prod")
            {
                mailMessage.Subject = "Your shipnpr.shiptalk.org registration(" + ConfigUtil.WebEnvironment + ")";
            }
            else
            {
                mailMessage.Subject = "Your shipnpr.shiptalk.org registration";
            }

            Guid   VerificationToken  = DataLayer.UserDAL.GetEmailVerificationTokenForUser(UserRegistrationData.UserId);
            string sVerificationToken = string.Empty;

            if (VerificationToken == Guid.Empty)
            {
                return(false);
            }
            else
            {
                sVerificationToken = VerificationToken.ToString();
            }

            string linkFormat       = "<a href='" + ConfigUtil.EmailConfirmationUrl + "?evt={0}'>Follow this link</a>";
            string confirmLinkParam = UserRegistrationData.PrimaryEmail + sVerificationToken;
            string confirmLink      = string.Format(linkFormat, confirmLinkParam);
            string textlink         = ConfigUtil.EmailConfirmationUrl + "?evt={0}";

            textlink = string.Format(textlink, confirmLinkParam);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (ConfigUtil.WebEnvironment != "prod")
            {
                sb.AppendFormat("-----------TEST  User Registration DEV site------------"); sb.AddNewHtmlLines(2);
                sb.AppendFormat("-----------Created from DEV environment: {0}------------", ConfigUtil.WebEnvironment); sb.AddNewHtmlLines(2);;
            }
            sb.AppendFormat("Dear {0} {1},", UserRegistrationData.FirstName.ToCamelCasing(), UserRegistrationData.LastName.ToCamelCasing());
            sb.AddNewHtmlLines(2);
            sb.Append("Thank you for registering at shipnpr.shiptalk.org.");
            sb.AddNewHtmlLines(3);
            sb.AppendFormat(confirmLink);
            sb.Append(" to verify your email address and submit your registration for approval. If you have difficulties accessing the link, copy and paste the link below to your browser to verify your email address.");
            sb.AddNewHtmlLines(2);
            sb.Append(textlink);
            sb.AddNewHtmlLines(3);
            sb.Append("You will receive an e-mail within a few days notifying you about the status of your registration request.");
            sb.AddNewHtmlLines(3);
            sb.Append("Thank you,");
            sb.AddNewHtmlLines(2);
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.EmailOfResourceCenter);
            sb.AddNewHtmlLines(5);

            mailMessage.Body = sb.ToString();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            if (!mail.SendMail())
            {
                ErrorMessage = string.Format("An error occured while sending email to {0}.", UserRegistrationData.PrimaryEmail);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 10
0
        private static bool SendUserEmailChangeVerificationEmail(int UserId, string NewEmail, out string ErrorMessage)
        {
            ErrorMessage = string.Empty;
            UserViewData UserRegistrationData = UserBLL.GetUser(UserId);

            ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);

            mailMessage.ToList.Add(NewEmail);
            mailMessage.Subject = "Your shipnpr.shiptalk.org Email Verification";

            Guid   VerificationToken  = DataLayer.UserDAL.GetEmailVerificationTokenForUser(UserRegistrationData.UserId);
            string sVerificationToken = string.Empty;

            if (VerificationToken == Guid.Empty)
            {
                return(false);
            }
            else
            {
                sVerificationToken = VerificationToken.ToString();
            }

            string AcceptLinkFormat = "<a href='" + ConfigUtil.EmailConfirmationUrl + "?evty=eca&evt={0}'>Accept</a>";
            string RejectLinkFormat = "<a href='" + ConfigUtil.EmailConfirmationUrl + "?evty=ecr&evt={0}'>Reject</a>";

            string confirmLinkParam = NewEmail + sVerificationToken;

            string AcceptLink = string.Format(AcceptLinkFormat, confirmLinkParam);
            string RejectLink = string.Format(RejectLinkFormat, confirmLinkParam);

            string AcceptTextlink = ConfigUtil.EmailConfirmationUrl + "?evty=eca&evt={0}";
            string RejectTextlink = ConfigUtil.EmailConfirmationUrl + "?evty=ecr&evt={0}";

            AcceptTextlink = string.Format(AcceptTextlink, confirmLinkParam);
            RejectTextlink = string.Format(RejectTextlink, confirmLinkParam);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendFormat("Dear {0} {1},", UserRegistrationData.FirstName.ToCamelCasing(), UserRegistrationData.LastName.ToCamelCasing());
            sb.AddNewHtmlLines(2);
            sb.Append("You have requested to change your Email at shipnpr.shiptalk.org.");
            sb.AddNewHtmlLines(3);
            sb.Append("Click on ");
            sb.AppendFormat(AcceptLink);
            sb.Append(" to verify your email address. If you have difficulties accessing the link, copy and paste the link below to your browser to verify your email address.");
            sb.AddNewHtmlLines(2);
            sb.Append(AcceptTextlink);
            sb.AddNewHtmlLines(2);
            sb.Append("If you didn't request this email change or if you don't want to change your email, click on ");
            sb.AppendFormat(RejectLink);
            sb.Append(" to cancel this request. If you have difficulties accessing the link, copy and paste the link below to your browser to cancel this request.");
            sb.AddNewHtmlLines(2);
            sb.Append(RejectTextlink);
            sb.AddNewHtmlLines(2);
            sb.Append("These links will expire in 24 hours. Please make sure you Accept or Reject this change within 24 hours.");
            sb.AddNewHtmlLines(3);
            sb.Append("Thank you,");
            sb.AddNewHtmlLines(2);
            sb.Append("SHIP NPR Help Desk");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.EmailOfResourceCenter);
            sb.AddNewHtmlLines(5);

            mailMessage.Body = sb.ToString();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            if (!mail.SendMail())
            {
                ErrorMessage = string.Format("An error occured while sending email to {0}.", NewEmail);
                return(false);
            }
            else
            {
                return(true);
            }
        }