Exemple #1
0
        private void SendEmail()
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        subject       = "Welcome to FlexibleTennisLeague";

            try
            {
                MailMessage mailMessage = new MailMessage();

                mailMessage.From = new MailAddress("*****@*****.**");
                mailMessage.To.Add(CreateUserWizard1.UserName);
                mailMessage.Bcc.Add(WebConfigurationManager.AppSettings["EmailId"].ToString());
                mailMessage.Subject = subject;

                TextBox firstNameTextBox = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("firstNameTextBox");
                TextBox lastNameTextBox  = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("lastNameTextBox");

                stringBuilder.Append(string.Format("Dear {0} {1},\r\n\r\n", firstNameTextBox.Text, lastNameTextBox.Text));
                stringBuilder.Append("Thank you for joining the FlexibleTennisLeague. Discover how easy it is to play competitive tennis at your convenience.\r\n");
                stringBuilder.Append("While we set up your account please use your login information below to browse through the site and familiarize yourself with the league's rules.\r\n\r\n");
                stringBuilder.Append(string.Format("User Name: {0}\r\n", CreateUserWizard1.UserName));
                stringBuilder.Append(string.Format("Password: {0}\r\n\r\n", CreateUserWizard1.Password));
                stringBuilder.Append("Once we complete setting up your account, we will send you an email informing you of your account status. This process is usually completed within 12 hours.\r\n");
                stringBuilder.Append("FlexibleTennisLeague takes its customer satisfaction very seriously. If you have any questions, comments or suggestions please email us at: [email protected] or [email protected].\r\n\r\n");
                stringBuilder.Append("In order to ensure the timely delivery of emails regarding your tennis matches or scores please add [email protected] to your list of known senders.\r\n\r\n");
                stringBuilder.Append("Thank you for signing up with FlexibleTennisLeague\r\n");
                stringBuilder.Append("Administrator -- FlexibleTennisLeague.");


                mailMessage.Body = Server.HtmlEncode(stringBuilder.ToString());

                SmtpClient smtpClient = new SmtpClient();
                smtpClient.Send(mailMessage);
            }
            catch (Exception exception)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    int?id = null;
                    dataContext.InsertEmailError(StoredData.User.UserId, CreateUserWizard1.UserName, CreateUserWizard1.UserName, subject, stringBuilder.ToString(), exception.Message + "\r\n\r\n" + exception.StackTrace, ref id);
                }
            }
        }
Exemple #2
0
        private void SendEmail(string opponentEmailId, string winner, string score)
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        subject       = "Score posted on FlexibleTennisLeague";

            try
            {
                MailMessage mailMessage = new MailMessage();

                mailMessage.From = new MailAddress("*****@*****.**");
                mailMessage.To.Add(opponentEmailId);
                mailMessage.CC.Add(StoredData.User.EmailId);
                mailMessage.Bcc.Add(WebConfigurationManager.AppSettings["EmailId"].ToString());
                mailMessage.Subject = subject;

                stringBuilder.Append(string.Format("Dear {0},\r\n\r\n", opponentDropDownList.SelectedItem.Text));
                stringBuilder.Append(string.Format("The following score for your recent match against {0} {1} at {2} has been posted on {3} {4}\r\n\r\n", StoredData.User.FirstName, StoredData.User.LastName, locationDropDownList.SelectedItem.Text, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString()));
                stringBuilder.Append(string.Format("Winner : {0}\r\n", winner));
                stringBuilder.Append(string.Format("Score : {0}\r\n", score));
                stringBuilder.Append(string.Format("Was no show : {0}\r\n\r\n", noShowCheckBox.Checked.ToString()));
                stringBuilder.Append("Please login to the FlexibleTennisLeague.com to rate your game and your opponent's game.\r\n");
                stringBuilder.Append("Please email incorrect scores and other complaints/suggestions to [email protected].\r\n\r\n");
                stringBuilder.Append("Thank you for choosing FlexibleTennisLeague.\r\n");
                stringBuilder.Append("Administrator -- FlexibleTennisLeague.");

                mailMessage.Body = Server.HtmlEncode(stringBuilder.ToString());

                SmtpClient smtpClient = new SmtpClient();
                smtpClient.Send(mailMessage);
            }
            catch (Exception exception)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    int?id = null;
                    dataContext.InsertEmailError(StoredData.User.UserId, opponentEmailId, StoredData.User.EmailId, subject, stringBuilder.ToString(), exception.Message + "\r\n\r\n" + exception.StackTrace, ref id);
                }
            }
        }
Exemple #3
0
        private void SendEmail()
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        subject       = "Welcome to FlexibleTennisLeague";

            try
            {
                MailMessage mailMessage = new MailMessage();

                mailMessage.From = new MailAddress("*****@*****.**");
                mailMessage.To.Add(HttpContext.Current.User.Identity.Name);
                mailMessage.Bcc.Add(WebConfigurationManager.AppSettings["EmailId"].ToString());
                mailMessage.Subject = subject;

                stringBuilder.Append(string.Format("Dear {0} {1},\r\n\r\n", StoredData.User.FirstName, StoredData.User.LastName));
                stringBuilder.Append(string.Format("Thank you for joining the {0} season of the FlexibleTennisLeague.\r\n", ViewState["NextDivisionText"].ToString()));
                stringBuilder.Append("Once we complete setting up your account, we will send you an email informing you of your account status. This process is usually completed within 12 hours.\r\n");
                stringBuilder.Append("FlexibleTennisLeague takes its customer satisfaction very seriously. If you have any questions, comments or suggestions please email us at: [email protected] or [email protected].\r\n\r\n");
                stringBuilder.Append("In order to ensure the timely delivery of emails regarding your tennis matches or scores please add [email protected] to your list of known senders.\r\n\r\n");
                stringBuilder.Append("Thank you for signing up with FlexibleTennisLeague\r\n");
                stringBuilder.Append("Administrator -- FlexibleTennisLeague.");


                mailMessage.Body = Server.HtmlEncode(stringBuilder.ToString());

                SmtpClient smtpClient = new SmtpClient();
                smtpClient.Send(mailMessage);
            }
            catch (Exception exception)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    int?id = null;
                    dataContext.InsertEmailError(StoredData.User.UserId, HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, subject, stringBuilder.ToString(), exception.Message + "\r\n\r\n" + exception.StackTrace, ref id);
                }
            }
        }
Exemple #4
0
        private bool SendEmail(string toEmailAddress, StringBuilder message, string subject)
        {
            bool emailSent = false;

            try
            {
                MailMessage mailMessage = new MailMessage();

                mailMessage.From = new MailAddress("*****@*****.**");
                mailMessage.To.Add(toEmailAddress);
                mailMessage.CC.Add(StoredData.User.EmailId);
                mailMessage.ReplyTo = new MailAddress(StoredData.User.EmailId, StoredData.User.FirstName + " " + StoredData.User.LastName);
                mailMessage.Bcc.Add(WebConfigurationManager.AppSettings["EmailId"].ToString());
                mailMessage.Subject = subject;

                message.Append("\r\n\r\nPlease email your questions and complaints/suggestions to [email protected].\r\n\r\n");
                message.Append("Thank you for choosing FlexibleTennisLeague.\r\n");
                message.Append("Administrator -- FlexibleTennisLeague.");

                mailMessage.Body = Server.HtmlEncode(message.ToString());

                SmtpClient smtpClient = new SmtpClient();
                smtpClient.Send(mailMessage);
                emailSent = true;
            }
            catch (Exception exception)
            {
                emailSent = false;
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    int?id = null;
                    dataContext.InsertEmailError(StoredData.User.UserId, toEmailAddress, StoredData.User.EmailId, subject, message.ToString(), exception.Message + "\r\n\r\n" + exception.StackTrace, ref id);
                }
            }
            return(emailSent);
        }