private bool SendPasswordResetEmail()
        {
            ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);

            mailMessage.ToList.Add(EmailAddress);

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

            mailMessage.Body = CreateEmailBodyForResetPassword();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            if (!mail.SendMail())
            {
                DisplayMessage("An error occured while sending password reset instructions by email. If the problem persists, please contact SHIP NPR Help Desk.", true);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RaisedEvent = TemplatedMailWebEventProvider.CurrentNotification.Events[0] as WebBaseErrorEvent;

            if (RaisedEvent != null)
            {
                Page.DataBind();
                //if (ConfigUtil.HostingPlace.ToLower() == "orcsweb")
                //{
                ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);

                mailMessage.ToList.Add(ConfigUtil.EmailOfTechSupport);
                // mailMessage.ToList.Add(ConfigUtil.EmailOfCriticalErrorCC);
                mailMessage.Subject = "Event Notification";
                mailMessage.Body    = errordiv.InnerHtml;


                //Send Mail here
                ShiptalkMail mail = new ShiptalkMail(mailMessage);
                mail.SendMail();
                //}
            }



            Application.Remove("WebEventRequestInformation");
        }
Exemple #3
0
        //this UserId is passed is the RegisteredUserId/requester UserId
        private static bool SendApprovedEmail(int UserId, string uniqueId)
        {
            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 for a CMS SHIP Unique ID has been approved.");
            sb.AddNewHtmlLines(2);

            //sammit: new business rule do not show the unique ID in the e-mail
            //sb.Append("Your CMS SHIP Unique ID is: " + uniqueId);
            //sb.AddNewHtmlLines(2);

            sb.Append("You may login anytime to the SHIPtalk website and find 'CMS SHIP Unique ID' under 'My Profile'.");
            sb.AddNewHtmlLines(2);

            sb.Append("Note: The Unique ID will not be recognized by Customer Services Representatives until the 1st week of the following month.");
            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(userView.PrimaryEmail);
            mailMessage.Subject = "Your SHIPtalk.org request for CMS SHIP Unique ID";

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


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

            return(false);
        }
Exemple #4
0
        //Added Lavanya
        public static bool SendEmailToUserAboutEmailChangeEmailVerification(string UserName)
        {
            string EmailAddress = UserName;

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

            mailMessage.ToList.Add(EmailAddress);
            mailMessage.Subject = "Changes to your account at shipnpr.shiptalk.org";

            mailMessage.Body = CreateEmailBodyForEmailChangeConfirmation();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            return(mail.SendMail());
        }
Exemple #5
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);
        }
Exemple #6
0
        private static bool SendRevokeEmail(int RegisteredUserId)
        {
            UserViewData userView = UserBLL.GetUser(RegisteredUserId);

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

            sb.AppendFormat("Dear {0},", userView.FullName);
            sb.AddNewHtmlLines(2);
            sb.Append("Your CMS SHIP Unique ID has been revoked by the State SHIP Director or by the Administrator.");
            sb.AddNewHtmlLines(2);

            sb.Append("If you feel that your CMS SHIP Unique ID account has been deleted in error, please contact your State SHIP Director.");
            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(userView.PrimaryEmail);
            mailMessage.Subject = "Your SHIPtalk.org request for CMS SHIP Unique ID is revoked.";

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


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

            return(false);
        }
Exemple #7
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);
            }
        }
Exemple #8
0
        private bool SendEmailToUserAboutPasswordChange()
        {
            string EmailAddress = UserName;

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

            mailMessage.ToList.Add(EmailAddress);

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

            mailMessage.Body = CreateEmailBodyForPasswordChangeConfirmation();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            return(mail.SendMail());
        }
Exemple #9
0
        private static bool EmailNotifyUniqueIDApprovers(int RequestedUserId)
        {
            //Prepare Mail Object
            ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);
            UserViewData        userData    = UserBLL.GetUser(RequestedUserId);

            var Approvers = GetApproversForUser(RequestedUserId);

            foreach (var approver in Approvers)
            {
                mailMessage.ToList.Add(approver.Value);
            }

            mailMessage.Subject = "New CMS SHIP Unique ID request";

            //PREPARE BODY OF EMAIL
            StringBuilder sbMailBody = new StringBuilder();

            sbMailBody.Append("A SHIP User has requested a new CMS SHIP Unique ID. Please login to <a href='https://shipnpr.shiptalk.org'>https://shipnpr.shiptalk.org</a> to respond the request.");
            sbMailBody.Append(" Go to the 'User' screen and click on 'Review, Approve, Deny CMS SHIP Unique ID Requests' to view and approve/deny this request.");
            sbMailBody.AddNewHtmlLines(3);
            sbMailBody.Append("A brief snapshot of the user profile is provided below:");
            sbMailBody.AddNewHtmlLines(2);
            sbMailBody.AppendFormat("Name: {0}{1} {2}", userData.FirstName,
                                    string.IsNullOrEmpty(userData.MiddleName) ? string.Empty : " " + userData.MiddleName,
                                    userData.LastName);
            sbMailBody.AddNewHtmlLine();
            sbMailBody.AppendFormat("Primary Email: {0}", userData.PrimaryEmail);
            sbMailBody.AddNewHtmlLine();
            sbMailBody.AppendFormat("Primary Phone: {0}", userData.PrimaryPhone);
            sbMailBody.AddNewHtmlLines(3);
            mailMessage.Body = sbMailBody.ToString();

            //Send Mail here
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            return(mail.SendMail());
        }
Exemple #10
0
        public static bool NotifyDesignatedRegistrationNotificationRecipientForUser(string UserName)
        {
            int?UserId = UserDAL.GetUserIdForUserName(UserName);

            if (UserId.HasValue)
            {
                //Prepare Mail Object
                ShiptalkMailMessage mailMessage = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);
                UserProfile         userProfile = UserBLL.GetUserProfile(UserId.Value);
                UserAccount         userAccount = UserBLL.GetUserAccount(UserId.Value);

                var Approvers = GetApproversForUser(UserId.Value);
                foreach (var approver in Approvers)
                {
                    mailMessage.ToList.Add(approver.Value);
                }


                if (ConfigUtil.WebEnvironment != "prod")
                {
                    mailMessage.Subject = "New shipnpr.shiptalk.org(" + ConfigUtil.WebEnvironment + ")Registration";
                }
                else
                {
                    mailMessage.Subject = "New shipnpr.shiptalk.org Registration";
                }
                mailMessage.Body = CreateEmailBodyForRegistrationNotification(userProfile, userAccount);

                //Send Mail here
                ShiptalkMail mail = new ShiptalkMail(mailMessage);
                return(mail.SendMail());
            }
            else
            {
                throw new ShiptalkException("Unable to find UserId for Username: " + UserName, false);
            }
        }
Exemple #11
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);
        }
        //private string EmailAddress { get { return UserName;} }


        private bool SendEmailToUserAboutPasswordChange()
        {
            //string EmailAddress = UserName; commented by BM, user not yest logged in so, account info does not have e-mail.
            // We will get e-mail from User account

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

            mailMessage.ToList.Add(EmailAddress);


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

            mailMessage.Body = CreateEmailBodyForPasswordChangeConfirmation();
            ShiptalkMail mail = new ShiptalkMail(mailMessage);

            return(mail.SendMail());
        }
        //DID not work the OR and IN search implementation
        //protected void Application_Start(object sender, EventArgs e)
        //{

        //    Lucene.Net.Analysis.StopAnalyzer.ENGLISH_STOP_WORDS_SET = new System.Collections.Hashtable();


        //}

        protected void Application_Error(object sender, EventArgs e)
        {
            // Get the error details
            var lastErrorWrapper = Server.GetLastError();

            Exception lastError = lastErrorWrapper;

            if (lastErrorWrapper.InnerException != null)
            {
                lastError = lastErrorWrapper.InnerException;
            }

            string lastErrorTypeName   = lastError.GetType().ToString();
            string lastErrorMessage    = lastError.Message;
            string lastErrorStackTrace = lastError.StackTrace;


            const string Subject = "An Error Has Occurred!";

            string htmlyellomsg = string.Empty;


            HttpUnhandledException httpUnhandledException = new HttpUnhandledException(Server.GetLastError().Message, Server.GetLastError());

            htmlyellomsg = httpUnhandledException.GetHtmlErrorMessage();

            //If you do not call Server.ClearError or trap the error in the Page_Error or Application_Error event handler,
            //the error is handled based on the settings in the section of the Web.config file.

            //////Server.ClearError();

            //Prepare Mail Object
            ShiptalkMailMessage mm = new ShiptalkMailMessage(true, ShiptalkMailMessage.MailFrom.ShiptalkResourceCenter);


            mm.ToList.Add(ConfigUtil.CriticalErrorEmail);

            if (ConfigUtil.CriticalErrorEmailCC.Length > 0)
            {
                mm.ToList.Add(ConfigUtil.CriticalErrorEmailCC);
            }

            mm.Subject = Subject;

            mm.Body = string.Format(@"
                                    <html>
                                    <body>
                                      <h1>An Error Has Occurred!</h1>
                                      <table cellpadding=""5"" cellspacing=""0"" border=""1"">
                                      <tr>
                                      <tdtext-align: right;font-weight: bold"">URL:</td>
                                      <td>{0}</td>
                                      </tr>
                                      <tr>
                                      <tdtext-align: right;font-weight: bold"">User:</td>
                                      <td>{1}</td>
                                      </tr>
                                      <tr>
                                      <tdtext-align: right;font-weight: bold"">Exception Type:</td>
                                      <td>{2}</td>
                                      </tr>
                                      <tr>
                                      <tdtext-align: right;font-weight: bold"">Message:</td>
                                      <td>{3}</td>
                                      </tr>
                                      <tr>
                                      <tdtext-align: right;font-weight: bold"">Stack Trace:</td>
                                      <td>{4}</td>
                                      </tr> 

                                      </table>
                                    </body>
                                    </html>
                                        {5}
                                        ",
                                    Request.RawUrl,
                                    User.Identity.Name,
                                    lastErrorTypeName,
                                    lastErrorMessage,
                                    lastErrorStackTrace.Replace(Environment.NewLine, "<br />"),
                                    htmlyellomsg
                                    )
            ;


            //// Attach the Yellow Screen of Death for this error
            //string YSODmarkup = lastErrorWrapper.GetHtmlErrorMessage();
            //if (!string.IsNullOrEmpty(YSODmarkup))
            //{

            //}


            //Send Mail here
            if (ConfigUtil.WebEnvironment != "dev")
            {
                ShiptalkMail mail = new ShiptalkMail(mm);
                mail.SendMail();
            }
        }
Exemple #14
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);
            }
        }
Exemple #15
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);
            }
        }
Exemple #16
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);
            }
        }
Exemple #17
0
        protected bool SendVerificationEmail(int newUserId)
        {
            string EmailAddress = UserName;

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

            if (VerificationToken == Guid.Empty)
            {
                DisplayMessage("An error occured while preparing content for email address verification procedure. Please contact support if this issue persists.", true);
                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);

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

            sb.AppendFormat("Dear {0} {1},", FirstName.Text.Trim().ToCamelCasing(), LastName.Text.Trim().ToCamelCasing());
            sb.AddNewHtmlLines(2);
            sb.Append("A new user account has been registered for you, at the SHIPtalk.org web site.");
            sb.AddNewHtmlLines(2);
            sb.Append("It is required that you verify your email address using the following link:");
            sb.AddNewHtmlLine();
            sb.AppendFormat(confirmLink);
            sb.AddNewHtmlLines(2);
            sb.Append("You will be able to login to the SHIPtalk web site upon successful verification of the email using the above link.");
            sb.AddNewHtmlLine();
            sb.AppendFormat("If you would like to contact the person who created your account, please use the following email address: {0}", this.AccountInfo.PrimaryEmail);
            sb.AddNewHtmlLines(2);
            sb.Append("Thank you,");
            sb.AddNewHtmlLine();
            sb.Append("SHIPtalk.org");
            sb.AddNewHtmlLine();
            sb.Append(ConfigUtil.ShiptalkSupportPhone);
            sb.AddNewHtmlLines(5);


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

            mailMessage.ToList.Add(this.UserName);
            mailMessage.Subject = "Welcome to SHIPtalk.org!";

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

            if (!mail.SendMail())
            {
                DisplayMessage("An error occured while sending email to the address provided.", true);
                return(false);
            }
            else
            {
                return(true);
            }
        }