//--------------------------------------------------------
    protected void btnSend_Click(object sender, EventArgs e)
    {
        if (cblMailListGroups.SelectedIndex < 0)
        {
            General.MakeAlertError(lblResult, Resources.MailListAdmin.Result_ChoesOneGroupAtLeast);
            return;
        }
        //-------------------------------------------------------------
        Languages langID = Languages.Unknowen;

        if (trLanguages.Visible)
        {
            langID = (Languages)Convert.ToInt32(ddlLanguages.SelectedValue);
        }
        //-------------------------------------------------------------

        #region Attachments
        if (SiteSettings.MailList_HasAttachments)
        {
            //-----------------------------------------------------------------
            attachmentsPathes = new List <string>();
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach1);
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach2);
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach3);
            //-----------------------------------------------------------------
        }
        #endregion
        //////////////////////////////////////////////////////////////////////////////////////
        int           groupID;
        List <string> usersList;
        foreach (ListItem item in cblMailListGroups.Items)
        {
            if (item.Selected)
            {
                groupID = Convert.ToInt32(item.Value);

                usersList = MailListUsersFactory.GetAllEmailsOnly(ModuleTypeID, langID, groupID, true);
                foreach (string userEMail in usersList)
                {
                    if (mail == null)
                    {
                        BuildEmail();
                    }
                    mail.To.Add(userEMail);
                    MailListEmailsFactory.Send(mail);
                    mail.Dispose();
                    mail = null;
                }
            }
        }
        //SaveArchive
        //if (usersList.Count > 0)
        SaveArchive();

        //-------------------------------------------

        ///////////////////////////////////////////////////////////////////////////////////

        General.MakeAlertSucess(lblResult, Resources.MailListAdmin.Result_SendingDone);
    }
            protected void SendEmail(MailListUsersEntity user)
            {
                // prepare message
                string body = string.Format(DynamicResource.GetText("MailList", "ActivationMailBody"), new string[3] {
                    SitesHandler.GetSiteDomain(), Encryption.Encrypt(user.UserID.ToString()), user.Email
                });
                //string from =MailListEmailsFactory.MailFrom;
                MailListEmailsEntity mail = new MailListEmailsEntity();

                mail.Subject = DynamicResource.GetText("MailList", "ActivationMailSubject");
                mail.Body    = body;
                mail.To.Add(user.Email);
                MailListEmailsFactory.Send(mail);
            }
Exemple #3
0
        //------------------------------------------------------------------------------------
        public static void SendMailToSiteAdmin(string subject, string mailBody)
        {
            MailListEmailsEntity mail = new MailListEmailsEntity();
            //------------------------------------------------------------------------
            string to = SiteSettings.Admininstration_AdminEmail;

            mail.To.Add(to);
            //------------------------------------------------------------------------
            if (SiteSettings.Admininstration_HasAdminBccEmail)
            {
                string AdminbccMail = SiteSettings.Admininstration_AdminBccEmail;
                mail.Bcc.Add(AdminbccMail);
            }
            //------------------------------------------------------------------------
            mail.Subject = subject;
            //-------------------------------------
            mail.Body = mailBody;
            //------------------------------------------------------------------------
            mail.IsBodyHtml = true;

            MailListEmailsFactory.Send(mail);
        }
Exemple #4
0
    //-----------------------------------------------
    #endregion
    //-------------------------------------------------------
    #region ---------------SendMail---------------
    //-----------------------------------------------
    //SendMail
    //-----------------------------------------------
    protected void SendMail(MembershipUser user, UsersDataEntity usersData, string username, string pass)
    {
        MailListEmailsEntity mail = new MailListEmailsEntity();
        string subject            = "";
        string body = "";

        mail.To.Add(user.Email);
        //---------------------------------------------------------------------------------------------------------------
        subject = Resources.AdminText.AdminMessage_NewUserAccountCreationSubject;
        //---------------------------------------------------------------------------------------------------------------
        if (currentModule.SendingAcountDataInActivationMail)
        {
            string accountData = BuilAccountDataForMail(user, usersData, username, pass);
            body = string.Format(Resources.AdminText.AdminMessage_NewUserAccountCreationBody2, accountData);
        }
        else
        {
            body = string.Format(Resources.AdminText.AdminMessage_NewUserAccountCreationBody, username, pass);
        }
        //---------------------------------------------------------------------------------------------------------------
        mail.Subject = subject;
        mail.Body    = body;
        MailListEmailsFactory.Send(mail);
    }
Exemple #5
0
    //--------------------------------------------------------
    protected void btnSend_Click(object sender, EventArgs e)
    {
        if (Chkusers.SelectedIndex < 0)
        {
            lblResult.Text = Resources.MailListAdmin.Result_ChoesOneUserAtLeast;
            return;
        }
        //-------------------------------------------------------------
        int groupID = -1;// UnSpecified

        if (trGroups.Visible)
        {
            groupID = Convert.ToInt32(ddlMailListGroups.SelectedValue);
        }
        //-------------------------------------------------------------
        Languages langID = Languages.Unknowen;

        if (trLanguages.Visible)
        {
            langID = (Languages)Convert.ToInt32(ddlLanguages.SelectedValue);
        }
        //-------------------------------------------------------------


        //try
        //{

        #region Attachments
        if (SiteSettings.MailList_HasAttachments)
        {
            //-----------------------------------------------------------------
            attachmentsPathes = new List <string>();
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach1);
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach2);
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach3);
            //-----------------------------------------------------------------
        }
        #endregion
        //////////////////////////////////////////////////////////////////////////////////////
        foreach (ListItem item in Chkusers.Items)
        {
            if (item.Selected)
            {
                if (!string.IsNullOrEmpty(item.Text))
                {
                    BuildEmail();
                }
                mail.To.Add(item.Text);
                MailListEmailsFactory.Send(mail);
                mail.Dispose();
                mail = null;
            }
        }
        //SaveArchive
        //if (usersList.Count > 0)
        SaveArchive();

        //-------------------------------------------

        ///////////////////////////////////////////////////////////////////////////////////

        lblResult.CssClass = "operation_done";
        lblResult.Text     = Resources.MailListAdmin.Result_SendingDone;
    }
Exemple #6
0
    //--------------------------------------------------------
    protected void btnSend_Click(object sender, EventArgs e)
    {
        List <string> usersList = null;

        if (FormMailTo != FormMailToTypes.One)
        {
            //-------------------------------------------------------------
            int groupID = -1;// UnSpecified
            if (trGroups.Visible)
            {
                groupID = Convert.ToInt32(ddlMailListGroups.SelectedValue);
            }
            //-------------------------------------------------------------
            Languages langID = Languages.Unknowen;
            if (trLanguages.Visible)
            {
                langID = (Languages)Convert.ToInt32(ddlLanguages.SelectedValue);
            }
            //-------------------------------------------------------------
            usersList = MailListUsersFactory.GetAllEmailsOnly(ModuleTypeID, langID, groupID, true);
        }
        //try
        //{

        #region Attachments
        if (SiteSettings.MailList_HasAttachments)
        {
            //-----------------------------------------------------------------
            attachmentsPathes = new List <string>();
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach1);
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach2);
            MailListEmailsFactory.AddAttatchPath(attachmentsPathes, fuAttach3);
            //-----------------------------------------------------------------
        }
        #endregion
        //////////////////////////////////////////////////////////////////////////////////////
        int maxBccCount = SiteSettings.MailList_MaxBccCount;
        if (FormMailTo == FormMailToTypes.One)
        {
            //mail = new MailListEmailsEntity();
            BuildEmail(0, txtEmail.Text);
            mail.To.Add(txtEmail.Text);
            MailListEmailsFactory.Send(mail);
            //SaveArchive
            SaveArchive();
        }
        else
        {
            foreach (string userEMail in usersList)
            {
                if (mail == null)
                {
                    BuildEmail(0, userEMail);
                }
                mail.To.Add(userEMail);
                MailListEmailsFactory.Send(mail);
                mail.Dispose();
                mail = null;
            }
            //SaveArchive
            if (usersList.Count > 0)
            {
                SaveArchive();
            }

            /*
             * int x = 0;
             * foreach (MailListUsersEntity user in usersList)
             * {
             ++x;
             *  if (mail == null) BuildEmail();
             *  mail.Bcc.Add(user.Email);
             *  if (x >= maxBccCount)
             *  {
             *      //BuildEmail(mail, attachmentsPathes);
             *      MailListEmailsFactory.Send(mail);
             *      //Clear Bcc
             *
             *      mail.Bcc.Clear();
             *      mail.Dispose();
             *      mail = null;
             *      x = 0;
             *  }
             * }
             * if (x > 0)//Send to the last emails
             * {
             *  MailListEmailsFactory.Send(mail);
             * }*/
            //-------------------------------------------
        }
        ///////////////////////////////////////////////////////////////////////////////////

        lblResult.CssClass = "operation_done";
        lblResult.Text     = Resources.MailListAdmin.Result_SendingDone;
    }