Пример #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            var inviteFriendTemplate = new EmailTemplates.InviteFriend(LanguageId);

            HtmlInputCheckBox cbCheck;
            foreach (DataGridItem item in dgContacts.Items)
            {
                cbCheck = (HtmlInputCheckBox)item.FindControl("cbSelect");
                if (cbCheck.Checked)
                {
                    string content = htmlEditor != null ? htmlEditor.Content : ckeditor.Text;
                    Email.Send(Config.Misc.SiteTitle, Config.Misc.SiteEmail, ((Label)item.FindControl("lblName")).Text,
                               ((Label)item.FindControl("lblEmail")).Text,
                               inviteFriendTemplate.GetFormattedSubject(CurrentUserSession.Name), content,
                               false);
                }
            }

            StatusPageMessage = Lang.Trans("The invitation email has been sent to your friend.");
            Response.Redirect("ShowStatus.aspx");
        }
Пример #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Classes.User.ValidateEmail(txtFriendsEmail.Value.Trim());
            }
                //invalid email
            catch
            {
                lblError.Text = Lang.Trans("Invalid email!");
                return;
            }

            try
            {
                var inviteFriendTemplate = new EmailTemplates.InviteFriend(LanguageId);
                string body = htmlEditor != null ? htmlEditor.Content : ckeditor.Text;
                Email.Send(Config.Misc.SiteTitle, Config.Misc.SiteEmail, txtFriendsName.Value, txtFriendsEmail.Value.Trim(),
                           inviteFriendTemplate.GetFormattedSubject(CurrentUserSession.Name), body,
                           false);
            }
            catch (Exception ex)
            {
                Log(ex);
                return;
            }

            StatusPageMessage = Lang.Trans("The invitation email has been sent to your friend.");
            Response.Redirect("ShowStatus.aspx");
        }