public static void w_SendingMail(object sender, MailMessageEventArgs e)
 {
     if (e.Message.Body.IndexOf("123") > 0)
     {
         WebTest.CurrentTest.UserData = "w_SendingMail";
     }
 }
        protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
        {
            try
            {
                MembershipUser newUserAccount   = Membership.GetUser(RegisterUser.UserName);
                Guid           newUserAccountId = (Guid)newUserAccount.ProviderUserKey;
                string         domainName       = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
                string         confirmationPage = "EmailConfirmation.aspx?ID=" + newUserAccountId.ToString();
                string         url  = domainName + confirmationPage;
                string         Name = ((TextBox)RegisterUserWizardStep.ContentTemplateContainer.FindControl("Name")).Text;
                e.Message.Body = e.Message.Body.Replace("<%VerificationUrl%>", url);
                e.Message.Body = e.Message.Body.Replace("<%Name%>", Name);

                DALCommon cmn = new DALCommon();
                cmn.SendHtmlFormattedEmail(RegisterUser.Email, "Verification Code", e.Message.Body);

                Session["mailtxt"] = e.Message.Body.ToString();
                Session["email"]   = RegisterUser.Email;
                Page.ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>javascript:   document.getElementById('ahrfcreate').click();</script>");
                RegisterUser.CompleteSuccessText = "An email has been sent to your account. Please view the email and confirm your account to complete the registration process.";
                e.Cancel = true;
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #3
0
        protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
        {
            // get the username and password from the body
            string body = e.Message.Body;

            // remove first line...
            body = body.Remove(0, body.IndexOf('\n') + 1);
            // remove "Username: "******": ") + 2);
            // get first line which is the username
            string userName = body.Substring(0, body.IndexOf('\n'));

            // delete that same line...
            body = body.Remove(0, body.IndexOf('\n') + 1);
            // remove the "Password: "******": ") + 2);
            // the rest is the password...
            string password = body.Substring(0, body.IndexOf('\n'));

            // get the e-mail ready from the real template.
            YafTemplateEmail passwordRetrieval = new YafTemplateEmail("PASSWORDRETRIEVAL");

            string subject = String.Format(GetText("PASSWORDRETRIEVAL_EMAIL_SUBJECT"), PageContext.BoardSettings.Name);

            passwordRetrieval.TemplateParams["{username}"]  = userName;
            passwordRetrieval.TemplateParams["{password}"]  = password;
            passwordRetrieval.TemplateParams["{forumname}"] = PageContext.BoardSettings.Name;
            passwordRetrieval.TemplateParams["{forumlink}"] = String.Format("{0}", YafForumInfo.ForumURL);

            passwordRetrieval.SendEmail(e.Message.To[0], subject, true);

            // manually set to success...
            e.Cancel = true;
            PasswordRecovery1.TabIndex = 3;
        }
        /// <summary>
        /// Broadcasts an alert.
        /// </summary>
        /// <param name="message">The alert message to be broadcast.</param>
        public void Broadcast(MailMessage message)
        {
            try
            {
                this.traceSource.TraceVerbose("Broadcasting alert {0}", message);

                // Broadcast alert
                // TODO: Fix this, this is bad
                var args = new MailMessageEventArgs(message);
                this.Received?.Invoke(this, args);
                if (args.Ignore)
                {
                    return;
                }

                if (message.Flags != MailMessageFlags.Transient)
                {
                    this.Insert(message);
                }

                // Committed
                this.Committed?.BeginInvoke(this, args, null, null);
            }
            catch (Exception e)
            {
                this.traceSource.TraceError("Error broadcasting alert: {0}", e);
            }
        }
Beispiel #5
0
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        //ErrorLabel = (Label)PasswordRecovery1.FindControl("ErrorLabel");

        //string username = PasswordRecovery1.UserName.Trim();
        //string message = "";

        //if (username.Length >= 4)
        //{
        //    string userMailID = GetUserMailID(username);
        //    if (userMailID != "-1" && userMailID != "")
        //    {
        //        //  Reset the Password.
        //        string newPassword = GenerateRandomPassword();

        //        //  EMail the New Password to the User.
        //        string subject = "Message from Stoocks";
        //        string userMessage = "Your Password has been reset. The new Password is: " + newPassword;
        //        SendMail("*****@*****.**", userMailID, subject, userMessage);

        //        //  Hash the Password
        //        string passwordHash = HashPassword(newPassword);

        //        //  Reset the Password in the Database.
        //        ResetPassword(username, passwordHash);
        //        message = "Your Password has been E-Mailed.";
        //    }
        //    else
        //    {
        //        message = "No such Username exists for Stoocks.";
        //    }
        //    ErrorLabel.Text = message;
        //}
    }
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        //e.Cancel = true;
        //NetworkCredential loginInfo = new NetworkCredential("*****@*****.**", "online@cie");
        //SmtpClient client = new SmtpClient("smtp.gmail.com", 25);
        //client.EnableSsl = true;
        //client.UseDefaultCredentials = false;
        //client.Credentials = loginInfo;
        //using (MailMessage msg = new MailMessage())
        //{
        //    msg.From = new MailAddress("*****@*****.**");
        //    msg.To.Add(new MailAddress(e.Message.To.ToString()));
        //    msg.Subject = e.Message.Subject;
        //    msg.Body = e.Message.Body;
        //    msg.IsBodyHtml = true;
        //    client.Send(msg);
        //}

        e.Cancel = true;

        SmtpClient client = new SmtpClient();

        //enable SSL for gmail
        client.EnableSsl = true;

        //sending message
        client.Send(e.Message);
    }
Beispiel #7
0
 protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
 {
     SmtpClient mySmtpClient = new SmtpClient();
     mySmtpClient.EnableSsl = true;
     mySmtpClient.Send(e.Message);
     e.Cancel = true;
 }
        void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
        {
            e.Message.Body = e.Message.Body.Replace("{SiteName}", siteSettings.SiteName);
            e.Message.Body = e.Message.Body.Replace("{SiteLink}", SiteUtils.GetNavigationSiteRoot());

            // patch from voir hillaire for TLS/SSL problem
            if (WebConfigSettings.DisableDotNetOpenMail)
            {
                SmtpSettings smtpSettings = SiteUtils.GetSmtpSettings();
                if (smtpSettings.UseSsl)//using SSL requires using smtpSettings
                {
                    try
                    {
                        SmtpClient smtpSender = new SmtpClient(smtpSettings.Server, smtpSettings.Port);
                        smtpSender.DeliveryMethod = SmtpDeliveryMethod.Network;
                        smtpSender.Credentials    = new NetworkCredential(smtpSettings.User, smtpSettings.Password);
                        smtpSender.EnableSsl      = true;
                        smtpSender.Send(e.Message);
                        e.Cancel = true; //stop here so the "built-in" mail routine doesn't run
                    }
                    catch (SmtpException ex)
                    {
                        log.Error("password recovery error", ex);
                    }
                    catch (InvalidOperationException ex)
                    {
                        log.Error("password recovery error", ex);
                    }
                }
            }
        }
        /// <summary>
        /// Broadcast alert
        /// </summary>
        public void Broadcast(MailMessage msg)
        {
            try
            {
                this.m_tracer.TraceVerbose("Broadcasting alert {0}", msg);

                // Broadcast alert
                // TODO: Fix this, this is bad
                var args = new MailMessageEventArgs(msg);
                this.Received?.Invoke(this, args);
                if (args.Ignore)
                {
                    return;
                }

                if (msg.Flags == MailMessageFlags.Transient)
                {
                    ApplicationContext.Current.ShowToast(msg.Subject);
                }
                else
                {
                    this.Save(msg);
                }

                // Committed
                this.Committed?.BeginInvoke(this, args, null, null);
            }
            catch (Exception e)
            {
                this.m_tracer.TraceError("Error broadcasting alert: {0}", e);
            }
        }
Beispiel #10
0
    protected void RecoverPwd_SendingMail(object sender, MailMessageEventArgs e)
    {
        SmtpClient new1 = new SmtpClient();

        e.Message.CC.Add("*****@*****.**");
        new1.EnableSsl = true;
    }
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        MembershipUser mu = System.Web.Security.Membership.GetUser(PasswordRecovery1.UserName);
        if (mu != null) // The username exists
        {
            var userID = (Guid)mu.ProviderUserKey;
            PollinatorEntities mydb = new PollinatorEntities();
            var userDetail = (from ud in mydb.UserDetails
                              where ud.UserId == userID
                              select ud).FirstOrDefault();

            string name = PasswordRecovery1.UserName;

            if (userDetail != null)
            {
                name = userDetail.FirstName;
            }
            string logoPath = Request.Url.Authority + Request.ApplicationPath + "/Images/logo/Bee-Friendly-Farmer-Logo1.png";
            if (!logoPath.StartsWith("http://"))
                logoPath = "http://" + logoPath;

            e.Message.Body = e.Message.Body.Replace("{Logo}", logoPath);
            e.Message.Body = e.Message.Body.Replace("{FirstName}", name);
        }
    }
 protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
 {
     //using this event object to cancel the email and just display the password on the page
     e.Cancel = true;
     //using the successtext property to show the message which would have been sent in the email
     PasswordRecovery1.SuccessText = e.Message.Body;
 }
Beispiel #13
0
 protected void CreateUserWizard1SendingMail(object sender, MailMessageEventArgs e)
 {
     //Send the new member his password and security key
     //Message Body is in /App_Data/RegisterMail.txt
     var mp = (SnitzMembershipProvider)Membership.Providers["SnitzMembershipProvider"];
     //string msg;
     var cuw = (CreateUserWizard)sender;
     //string validationCode = cuw.Question;
     //Get the MembershipUser that we just created.
     var newUser = (SnitzMembershipUser)Membership.GetUser(cuw.UserName);
     //Create the validation code
     if (mp != null)
     {
         string validationCode = SnitzMembershipProvider.CreateValidationCode(newUser);
         mp.ChangePasswordQuestionAndAnswer(cuw.UserName, cuw.Password, validationCode, "validationcode");
         //And build the url for the validation page.
         var builder = new UriBuilder("http",
                                             Request.Url.DnsSafeHost,
                                             Request.Url.Port, Page.ResolveUrl("~/Account/activate.aspx"), "?C=" + validationCode);
         //Add the values to the mail message.
         e.Message.Body = e.Message.Body.Replace("<%OurForum%>", Config.ForumTitle);
         e.Message.Body = e.Message.Body.Replace("<%activationURL%>", builder.Uri.ToString().Replace(" ", "%20"));
         e.Message.Body = e.Message.Body.Replace("<%activationKey%>", validationCode);
     }
 }
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        Label lbl = (Label)PasswordRecovery1.SuccessTemplateContainer.FindControl("EmailLabel");
        lbl.Text = e.Message.To[0].Address;
        MembershipUser user = Membership.GetUser(PasswordRecovery1.UserName);
        string username = user.UserName;
        UserInfos userinfos = UserInfos.getUserInfos(username);
        string generatedPassword = user.ResetPassword();
        bool isChanged = false;
        try
        {
            string newPassword = "";
            newPassword = userinfos.UserCod ?? generatedPassword;
           //string newPassword = GetRandomPasswordUsingGUID(10);
           isChanged = user.ChangePassword(generatedPassword, newPassword);
		   user.IsApproved = true;
           e.Message.Body = "Parola dvs. a fost resetata. Va rugam sa va logati folosind ID-ul de  cont: " + user.UserName + " si parola: " + newPassword ;
           e.Message.Subject = "Recuperare parola";
           e.Message.Bcc.Add(new MailAddress("*****@*****.**"));
            //send mail to fccl 
        }
        catch (Exception ex)
        {
            string err = ex.Message;
            string trace = ex.StackTrace;
            Logger.Error(trace+"|"+err);
        }
    }
Beispiel #15
0
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        //e.Cancel = true;
        //NetworkCredential loginInfo = new NetworkCredential("*****@*****.**", "online@cie");
        //SmtpClient client = new SmtpClient("smtp.gmail.com", 25);
        //client.EnableSsl = true;
        //client.UseDefaultCredentials = false;
        //client.Credentials = loginInfo;
        //using (MailMessage msg = new MailMessage())
        //{
        //    msg.From = new MailAddress("*****@*****.**");
        //    msg.To.Add(new MailAddress(e.Message.To.ToString()));
        //    msg.Subject = e.Message.Subject;
        //    msg.Body = e.Message.Body;
        //    msg.IsBodyHtml = true;
        //    client.Send(msg);
        //}

        e.Cancel = true;

        SmtpClient client = new SmtpClient();

        //enable SSL for gmail
        client.EnableSsl = true;

        //sending message
        client.Send(e.Message);
    }
Beispiel #16
0
        public void SendMail(MailMessageEventArgs e)
        {
            GetSmtpClient().Send(e.Message);

            //Since the message is sent here, set cancel=true so the original SmtpClient will not try to send the message too:
            e.Cancel = true;
        }
Beispiel #17
0
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        MembershipUser mu = System.Web.Security.Membership.GetUser(PasswordRecovery1.UserName);

        if (mu != null) // The username exists
        {
            var userID = (Guid)mu.ProviderUserKey;
            PollinatorEntities mydb = new PollinatorEntities();
            var userDetail          = (from ud in mydb.UserDetails
                                       where ud.UserId == userID
                                       select ud).FirstOrDefault();

            string name = PasswordRecovery1.UserName;

            if (userDetail != null)
            {
                name = userDetail.FirstName;
            }
            string logoPath = Request.Url.Authority + Request.ApplicationPath + "/Images/logo/Bee-Friendly-Farmer-Logo1.png";
            if (!logoPath.StartsWith("http://"))
            {
                logoPath = "http://" + logoPath;
            }

            e.Message.Body = e.Message.Body.Replace("{Logo}", logoPath);
            e.Message.Body = e.Message.Body.Replace("{FirstName}", name);
        }
    }
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        Label lbl = (Label)PasswordRecovery1.SuccessTemplateContainer.FindControl("EmailLabel");

        lbl.Text = e.Message.To[0].Address;
        MembershipUser user              = Membership.GetUser(PasswordRecovery1.UserName);
        string         username          = user.UserName;
        UserInfos      userinfos         = UserInfos.getUserInfos(username);
        string         generatedPassword = user.ResetPassword();
        bool           isChanged         = false;

        try
        {
            string newPassword = "";
            newPassword = userinfos.UserCod ?? generatedPassword;
            //string newPassword = GetRandomPasswordUsingGUID(10);
            isChanged         = user.ChangePassword(generatedPassword, newPassword);
            user.IsApproved   = true;
            e.Message.Body    = "Parola dvs. a fost resetata. Va rugam sa va logati folosind ID-ul de  cont: " + user.UserName + " si parola: " + newPassword;
            e.Message.Subject = "Recuperare parola";
            e.Message.Bcc.Add(new MailAddress("*****@*****.**"));
            //send mail to fccl
        }
        catch (Exception ex)
        {
            string err   = ex.Message;
            string trace = ex.StackTrace;
            Logger.Error(trace + "|" + err);
        }
    }
Beispiel #19
0
 protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
 {
     e.Message.From = new System.Net.Mail.MailAddress(
         Configuration.GetReturnEmailAddress(), Configuration.GetReturnEmailName());
     e.Message.Subject    = Resources.Glossary.PasswordRecoverySubject;
     e.Message.IsBodyHtml = true;
 }
Beispiel #20
0
        protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
        {
            e.Message.Body = e.Message.Body.Replace("<% UserName %>", PasswordRecovery1.UserName);
            string url = WebConfigurationManager.AppSettings["PasswordRecoverySuccessURL"] == null ? "~/LoginPage.aspx" : WebConfigurationManager.AppSettings["PasswordRecoverySuccessURL"].ToString();

            e.Message.Body = e.Message.Body.Replace("<% URL %>", string.Format("http://flexibletennisleague.com/{0}", url.Remove(0, 1)));
        }
Beispiel #21
0
        // send user name and password to user personalized
        protected void OvationForGotPassword_SendingMail(object sender, MailMessageEventArgs e)
        {
            e.Cancel = true;

            MembershipUser lostinfoUer = Membership.GetUser(OvationForGotPassword.UserName);
            string         lostinfoPW  = lostinfoUer.GetPassword();



            RFPmailclientToUse = new SmtpClient();

            e.Message.From = new MailAddress("*****@*****.**", "Ovation and Lawyers Travel 2014 RFP");
            e.Message.To.Add(new MailAddress(OvationForGotPassword.UserName, getmypersonalName(lostinfoUer.ToString())));
            e.Message.Subject    = "Ovation and Lawyers Travel 2014 RFP your login info";
            e.Message.Priority   = MailPriority.High;
            e.Message.IsBodyHtml = false;
            e.Message.Body       = getmypersonalName(lostinfoUer.ToString()) + " here is your login information," + Environment.NewLine +
                                   Environment.NewLine +
                                   "User Name: " + lostinfoUer + Environment.NewLine + Environment.NewLine +
                                   "Password:  "******"Go to http://dev.ovationtravel.com/OvationRFP/login.aspx";



            // send the message
            RFPmailclientToUse.Send(e.Message);

            //and clean up resource
            RFPmailclientToUse.Dispose();

            // show success message
            OvationForGotPassword.SuccessText = @"<div class=""errors"" style=""width:800px;margin-top:20px;""><p style=""margin-left:10px;"">" + getmypersonalName(lostinfoUer.ToString()) + " your information has been sent to the email address you registered with.</p></div>";
        }
Beispiel #22
0
        /// <summary>
        /// Handles the SendingMail event of the PasswordRecovery1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MailMessageEventArgs"/> instance containing the event data.</param>
        protected void PasswordRecovery1_SendingMail([NotNull] object sender, [NotNull] MailMessageEventArgs e)
        {
            // get the username and password from the body
            var body = e.Message.Body;

            // remove first line...
            body = body.Remove(0, body.IndexOf('\n') + 1);

            // remove "Username: "******": ", StringComparison.Ordinal) + 2);

            // get first line which is the username
            var userName = body.Substring(0, body.IndexOf('\n'));

            // delete that same line...
            body = body.Remove(0, body.IndexOf('\n') + 1);

            // remove the "Password: "******": ", StringComparison.Ordinal) + 2);

            // the rest is the password...
            var password = body.Substring(0, body.IndexOf('\n'));

            var subject = this.GetTextFormatted("PASSWORDRETRIEVAL_EMAIL_SUBJECT", this.Get <YafBoardSettings>().Name);
            var logoUrl =
                $"{YafForumInfo.ForumClientFileRoot}{YafBoardFolders.Current.Logos}/{this.PageContext.BoardSettings.ForumLogo}";
            var themeCss =
                $"{this.Get<YafBoardSettings>().BaseUrlMask}{this.Get<ITheme>().BuildThemePath("bootstrap-forum.min.css")}";

            var userIpAddress = this.Get <HttpRequestBase>().GetUserRealIPAddress();

            // get the e-mail ready from the real template.
            var passwordRetrieval = new YafTemplateEmail("PASSWORDRETRIEVAL")
            {
                TemplateParams =
                {
                    ["{username}"]  = userName,
                    ["{password}"]  = password,
                    ["{ipaddress}"] = userIpAddress,
                    ["{forumname}"] = this.Get <YafBoardSettings>().Name,
                    ["{forumlink}"] = $"{YafForumInfo.ForumURL}",
                    ["{themecss}"]  = themeCss,
                    ["{logo}"]      = $"{this.Get<YafBoardSettings>().BaseUrlMask}{logoUrl}"
                }
            };

            passwordRetrieval.SendEmail(e.Message.To[0], subject, true);

            // log password reset attempt
            this.Logger.Log(
                userName,
                $"{userName} Requested a Password Reset",
                $"The user {userName} with the IP address: '{userIpAddress}' requested a password reset.",
                EventLogTypes.Information);

            // manually set to success...
            e.Cancel = true;
            this.PasswordRecovery1.TabIndex = 3;
        }
Beispiel #23
0
 protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
 {
     //cancel the email
     e.Cancel = true;
     //show the message that would have been sent in the amil on the screen
     //Use the sucessstext property of the passwordrecovery to show the message
     PasswordRecovery1.SuccessText = e.Message.Body;
 }
Beispiel #24
0
    protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
    {
        CreateUserWizard cuw = (CreateUserWizard)LoginView1.FindControl("CreateUserWizard1");
        MembershipUser user = Membership.GetUser(cuw.UserName);
        string verify_url = Request.Url.GetLeftPart(UriPartial.Authority) + Page.ResolveUrl("~/Verify.aspx?ID=" + user.ProviderUserKey.ToString());

        e.Message.Body = e.Message.Body.Replace("<%VerifyUrl%>", verify_url);
    }
    // this code send a carbon copy CC email to the webmaster
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        // get default email address from web.config appsettings section
        // string AdminEmail = ConfigurationManager.AppSettings["AdminEmail"];
        // string emailToWebConfig = AdminEmail.ToString();

        //e.Message.CC.Add(AdminEmail);
    }
Beispiel #26
0
 protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
 {
     e.Cancel = true;
     System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
     smtp.EnableSsl   = (WebConfig.Web.Smtp.Network.Port == 587);
     smtp.Credentials = new System.Net.NetworkCredential(WebConfig.Web.Smtp.Network.UserName, WebConfig.Web.Smtp.Network.Password);
     smtp.Send(e.Message);
 }
    // this code send a carbon copy CC email to the webmaster
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        // get default email address from web.config appsettings section
        string AdminEmail = ConfigurationManager.AppSettings["AdminEmail"];
        string emailToWebConfig = AdminEmail.ToString();

        e.Message.CC.Add(AdminEmail);
    }
        protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
        {
            SmtpClient smtpSender = new SmtpClient();

            smtpSender.EnableSsl = true;
            smtpSender.Send(e.Message);
            e.Cancel = true;
        }
Beispiel #29
0
    protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
    {
        string mailBody = e.Message.Body;

        mailBody       = mailBody.Replace("<%Email%>", CreateUserWizard1.Email);
        mailBody       = mailBody.Replace("<%Question%>", CreateUserWizard1.Question);
        mailBody       = mailBody.Replace("<%Answer%>", CreateUserWizard1.Answer);
        e.Message.Body = mailBody;
    }
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        SmtpClient smtpClient = new SmtpClient();

        smtpClient.EnableSsl = true;
        smtpClient.Send(e.Message);

        e.Cancel = true;
    }
    protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
    {
        MembershipUser newUser = Membership.GetUser(CreateUserWizard1.UserName);
        Guid newUserId = (Guid)newUser.ProviderUserKey;

        string baseUrl = Request.Url.GetLeftPart(UriPartial.Authority) + (Request.ApplicationPath.Equals("/") ? "" : Request.ApplicationPath);
        string verifyUrl = "/Views/AccountVerify.aspx?ID=" + newUserId.ToString();
        e.Message.Body = e.Message.Body.Replace("<%VerifyUrl%>", baseUrl + verifyUrl);
    }
Beispiel #32
0
    protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
    {
        //Customize the mail body by replacing the placeholders in the static mail body file with actual values.
        e.Message.Body = e.Message.Body.Replace("##Id##", Membership.GetUser(CreateUserWizard1.UserName).ProviderUserKey.ToString());
        e.Message.Body = e.Message.Body.Replace("##UserName##", CreateUserWizard1.UserName);

        string applicationFolder = Request.ServerVariables.Get("SCRIPT_NAME").Substring(0, Request.ServerVariables.Get("SCRIPT_NAME").LastIndexOf("/"));

        e.Message.Body = e.Message.Body.Replace("##FullRootUrl##", Helpers.GetCurrentServerRoot + applicationFolder);
    }
 protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
 {
     // Set MailMessage fields.
     e.Message.IsBodyHtml = false;
     e.Message.Subject    = "Спасибо за регистрацию на Сайте!";
     // Replace placeholder text in message body with information
     // provided by the user.
     e.Message.Body = e.Message.Body.Replace("<%PasswordQuestion%>", CreateUserWizard1.Question);
     e.Message.Body = e.Message.Body.Replace("<%PasswordAnswer%>", CreateUserWizard1.Answer);
 }
Beispiel #34
0
    protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
    {
        try
        {
            string confirmURL = HttpContext.Current.Request.Url.Scheme + "://" +
                                HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath + "/Organization/ListOrganizations.aspx";

            e.Message.From    = new System.Net.Mail.MailAddress(Configuration.GetReturnEmailAddress(), Configuration.GetReturnEmailName());
            e.Message.Body    = e.Message.Body.Replace("<%UserName%>", CreateUserWizard1.UserName);
            e.Message.Body    = e.Message.Body.Replace("<%Password%>", CreateUserWizard1.Password);
            e.Message.Body    = e.Message.Body.Replace("<%Link%>", "<a href=\"" + confirmURL + "\">" + confirmURL + "</a>");
            e.Message.Subject = Resources.UserData.UserCreatedSubject;

            string logoMessage = "";
            try
            {
                //Path to save the image
                //string appPath = HttpContext.Current.Request.PhysicalApplicationPath;
                string         appPath = AppDomain.CurrentDomain.BaseDirectory.ToString();
                string         file    = appPath + "Images\\logo.png";
                LinkedResource logo    = new LinkedResource(file);
                logo.ContentId = "companylogo";
                int imageHeight = 102;
                int imageWidth  = 120;

                logoMessage = logoMessage + "<table>";
                logoMessage = logoMessage + "<tr>";
                logoMessage = logoMessage + "<td><img src=\"cid:companylogo" + "\"";
                logoMessage = logoMessage + " width=\"" + imageWidth.ToString();
                logoMessage = logoMessage + "\"";
                logoMessage = logoMessage + " height=\"" + imageHeight.ToString();
                logoMessage = logoMessage + "\"></td>";
                logoMessage = logoMessage + "</tr>";
                logoMessage = logoMessage + "</table>";
                logoMessage = logoMessage + "<br />";

                AlternateView av1 = AlternateView.CreateAlternateViewFromString(logoMessage + e.Message.Body, null, MediaTypeNames.Text.Html);
                av1.LinkedResources.Add(logo);

                e.Message.AlternateViews.Add(av1);
            }
            catch (Exception q)
            {
                log.Warn("Failed to add logo to email new User", q);
            }

            e.Message.IsBodyHtml = true;
        }
        catch (Exception exc)
        {
            log.Error("Failed to construct a confirmation email for the creation of an account for user " + CreateUserWizard1.UserName, exc);
            e.Cancel = true;
            SystemMessages.DisplaySystemErrorMessage(Resources.UserData.MessageErrorSentMailNew);
        }
    }
Beispiel #35
0
        protected override void OnSendingMail(MailMessageEventArgs e)
        {
            e.Message.Subject = "New Web site user.";

            // Replace placeholder text in message body with information
            //  provided by the user.
            e.Message.Body.Replace("<%PasswordQuestion%>", this.Question);
            e.Message.Body.Replace("<%PasswordAnswer%>", this.Answer);

            base.OnSendingMail(e);
        }
 /// <summary>
 /// Handles the SendingMail event of the prPasswordRecover control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.Web.UI.WebControls.MailMessageEventArgs"/> instance containing the event data.</param>
 protected void prPasswordRecover_SendingMail(object sender, MailMessageEventArgs e)
 {
     try {
         MessageService messageService = new MessageService();
         messageService.Send(e.Message);
         e.Cancel = true;
     }
     catch (Exception ex) {
         Logger.Error("prPasswordRecover_SendingMail " + e.Message.To[0].Address, ex);
     }
 }
  }//Page_Load

  /// <summary>CreateUserWizard_SendingMail</summary>
  public void CreateUserWizard_SendingMail
  (
   object               sender, 
   MailMessageEventArgs e
  )
  {
   // Replace placeholder text in message body with information 
   // provided by the user.
   e.Message.Body.Replace("<%PasswordQuestion%>", CreateUserWizardMembership.Question);
   e.Message.Body.Replace("<%PasswordAnswer%>",   CreateUserWizardMembership.Answer);
  }//public void CreateUserWizard_SendingMail()
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        SmtpClient client = new SmtpClient();

        client.DeliveryMethod = SmtpDeliveryMethod.Network;

        client.Host                  = System.Configuration.ConfigurationManager.AppSettings["Host"];
        client.Port                  = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["Port"]);
        client.EnableSsl             = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["EnableSsl"]);
        client.UseDefaultCredentials = false;
        client.Credentials           = new System.Net.NetworkCredential(System.Configuration.ConfigurationManager.AppSettings["Email"], System.Configuration.ConfigurationManager.AppSettings["Password"]);
    }
Beispiel #39
0
    protected void _SendingMail(object sender, MailMessageEventArgs e)
    {
        Message1.Visible = true;
        Message1.Text    = "Sent mail to you to confirm the password change.";

        System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress("*****@*****.**", "Someone");
        System.Net.Mail.MailAddress copy = new System.Net.Mail.MailAddress("*****@*****.**", "Someone");

        e.Message.From = from;
        e.Message.CC.Add(copy);
        e.Message.Subject    = "Activity information for you";
        e.Message.IsBodyHtml = true;
    }
Beispiel #40
0
    // this code uses the CreateUserWizard.txt file in the EmailTemplates folder
    // it creates and sends a verification URL to the user before allowing login
    // user must click on link in email to verify email address
    // the verification takes place in Verification.aspx file
    protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
    {
        // Get the UserId of the just-added user
        MembershipUser newUser = Membership.GetUser(CreateUserWizard1.UserName);
        Guid newUserId = (Guid)newUser.ProviderUserKey;

        // Determine the full verification URL (i.e., http://yoursite.com/Verification.aspx?ID=...)
        string urlBase = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
        string verifyUrl = "/Users/Verification.aspx?ID=" + newUserId.ToString();
        string fullUrl = urlBase + verifyUrl;

        // Replace <%VerificationUrl%> with the appropriate URL and querystring
        e.Message.Body = e.Message.Body.Replace("<%VerificationUrl%>", fullUrl);
    }
Beispiel #41
0
    //send email for password recovery
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        MailMessage mm = new MailMessage();

        mm.From = e.Message.From;

        mm.Subject = e.Message.Subject.ToString();

        mm.To.Add(e.Message.To[0]);

        mm.Body = e.Message.Body;
        SmtpClient smtp = new SmtpClient();
        smtp.EnableSsl = true;

        smtp.Send(mm);
        e.Cancel = true;
    }
    protected void ChangePassword1_SendingMail(object sender, MailMessageEventArgs e)
    {
        //var userDetail = (from ud in mydb.UserDetails
        //                  where ud.UserId == (Guid)Membership.GetUser(Context.User.Identity.Name).ProviderUserKey
        //                  select ud).FirstOrDefault();

        // Set mail message fields.
        e.Message.Subject = "Changed Your Password on S.H.A.R.E!";
        String content = e.Message.Body;
        content = content.Replace("{ChangedDate}", DateTime.Now.ToString());
        content = content.Replace("{FirstName}", User.Identity.Name);
        content = content.Replace("{UserName}", User.Identity.Name);
        content = content.Replace("{Password}", ChangePassword1.NewPassword);

        var webAppPath = WebHelper.FullyQualifiedApplicationPath;
        content = content.Replace("{SiteLogo}", webAppPath + WebHelper.SiteLogo);

        e.Message.Body = content;
        //send for New User
        //myMail.From = new MailAddress(Utility.EmailConfiguration.WebMasterEmail, "Pollinator - Share Map");
    }
Beispiel #43
0
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        e.Cancel = true;
        MailMessage message = new MailMessage();
        message.IsBodyHtml = true;
        message.To.Add(e.Message.To.ToString());
        message.From = new MailAddress(Membership.GetUser("root").Email);
        message.Subject = e.Message.Subject;
        message.Body = e.Message.Body;

        try
        {
            SmtpClient client = new SmtpClient();
            client.EnableSsl = true;
            client.Send(message);
        }
        catch (Exception ex)
        {
            lblError.Text = CustomErrors.ERROR_EMAIL_FAILED;
        }
    }
 protected void RecoverPwd_SendingMail(object sender, MailMessageEventArgs e)
 {
     SmtpClient new1 = new SmtpClient();
     e.Message.CC.Add("*****@*****.**");
     new1.EnableSsl = true;
 }
Beispiel #45
0
 protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
 {
 }
Beispiel #46
0
 protected void PasswordRecoveryCtrl_SendingMail(object sender, MailMessageEventArgs e)
 {
     
 }
 protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
 {
     Label lbl = (Label)PasswordRecovery1.SuccessTemplateContainer.FindControl("EmailLabel");
       lbl.Text = e.Message.To[0].Address;
 }
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        e.Cancel = true;

        PasswordRecovery1.SuccessText = e.Message.Body;
    }
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {

        //e.Message.Body = string.Format("<% UserName %>Password: <% Password %>", TextBox1.Text);
    }
 // this code sends a duplicate email to the webmaster (address below must be corrected)
 // we could have done this from the MailDefinitions property window but it was more fun this way
 protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
 {
     // e.Message.CC.Add("*****@*****.**");
 }