Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient(TheSetupXMLFile.getInstance().smtp);


                Attachment attachment;

                for (int a = 0; a < TheSetupXMLFile.getInstance().profils[TheSetupXMLFile.getInstance().selectionProfil].filesPath.Count; a++)
                {
                    attachment = new Attachment(TheSetupXMLFile.getInstance().profils[TheSetupXMLFile.getInstance().selectionProfil].filesPath[a]);
                    mail.Attachments.Add(attachment);
                }


                mail.From = new MailAddress(TheSetupXMLFile.getInstance().mailUser);
                mail.To.Add(adresseto.Text);

                mail.Subject = TheSetupXMLFile.getInstance().profils[TheSetupXMLFile.getInstance().selectionProfil].subject;
                mail.Body    = TheSetupXMLFile.getInstance().profils[TheSetupXMLFile.getInstance().selectionProfil].mailContent;

                SmtpServer.Port        = int.Parse(TheSetupXMLFile.getInstance().port);
                SmtpServer.Credentials = new System.Net.NetworkCredential(TheSetupXMLFile.getInstance().userName, TheSetupXMLFile.getInstance().userPwd);
                SmtpServer.EnableSsl   = true;

                SmtpServer.Send(mail);
                MessageBox.Show("Votre email a bien été envoyé !");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void textChangedMail(object sender, EventArgs e)
        {
            TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].mailContent = textBoxMail.Text;


            TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].mailContent = textBoxMail.Text;
        }
        private void profilSelected(object sender, EventArgs e)
        {
            if (profilsList.SelectedIndex != -1)
            {
                buttonDeleteProfil.Enabled = true;
                buttonJoinFiles.Enabled    = true;
                textBoxMail.Enabled        = true;
                subjectBox.Enabled         = true;

                textBoxMail.Text = TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].mailContent;
                subjectBox.Text  = TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].subject;

                if (TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].filesPath.Count != 0)
                {
                    textBoxFiles.Text = TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].filesPath[0];
                }
                else
                {
                    textBoxFiles.Text = "Aucun fichiers";
                }
            }
            else
            {
                buttonJoinFiles.Enabled = false;
                textBoxMail.Enabled     = false;
                subjectBox.Enabled      = false;
            }
        }
Пример #4
0
        private void comboBox1_Click(object sender, EventArgs e)
        {
            comboBox1.Items.Clear();

            for (var i = 0; i < TheSetupXMLFile.getInstance().profils.Count; i++)
            {
                comboBox1.Items.Add(TheSetupXMLFile.getInstance().profils[i].profilName);
            }
        }
        private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].filesPath.Clear();

            foreach (String name in openFileDialog1.FileNames)
            {
                TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].filesPath.Add(name);
            }
        }
        private void closeWindow(object sender, EventArgs e)
        {
            TheSetupXMLFile.getInstance().mailUser = textBox1.Text;
            TheSetupXMLFile.getInstance().port     = textPort.Text;
            TheSetupXMLFile.getInstance().smtp     = textSMTP.Text;
            TheSetupXMLFile.getInstance().userName = textUser.Text;
            TheSetupXMLFile.getInstance().userPwd  = textMpd.Text;
            //TheSetupXMLFile.getInstance().mailContent = textBoxMail.Text;
            TheSetupXMLFile.getInstance().saveXML();

            profilsList.Items.Clear();
            this.Close();
        }
        private void removeProfile(object sender, EventArgs e)
        {
            if (profilsList.SelectedIndex != -1)
            {
                TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].live = false;
                //TheSetupXMLFile.getInstance().profils.RemoveAt(profilsList.SelectedIndex);
                profilsList.Items.RemoveAt(profilsList.SelectedIndex);
            }

            if (profilsList.Items.Count == 0)
            {
                buttonJoinFiles.Enabled = false;
                textBoxMail.Enabled     = false;
                subjectBox.Enabled      = false;
            }
        }
        public ParamsForm()
        {
            TheSetupXMLFile.getInstance().readXML();
            InitializeComponent();

            textBox1.Text = TheSetupXMLFile.getInstance().mailUser; //ID
            textMpd.Text  = TheSetupXMLFile.getInstance().userPwd;  //MPD
            textSMTP.Text = TheSetupXMLFile.getInstance().smtp;     //SMTP
            textUser.Text = TheSetupXMLFile.getInstance().userName;
            textPort.Text = TheSetupXMLFile.getInstance().port;
            //textBoxMail.Text = TheSetupXMLFile.getInstance().mailContent;

            for (var i = 0; i < TheSetupXMLFile.getInstance().profils.Count; i++)
            {
                profilsList.Items.Add(TheSetupXMLFile.getInstance().profils[i].profilName);
            }
        }
        private void addProfile(object sender, EventArgs e)
        {
            bool dejaAdd = false;

            for (int a = 0; a < profilsList.Items.Count; a++)
            {
                if (profilsList.Items[a].Equals(textProfil.Text))
                {
                    dejaAdd = true;
                    break;
                }
            }

            if (dejaAdd == false)
            {
                profilsList.Items.Add(textProfil.Text);
                Profile profil = new Profile();
                profil.profilName = textProfil.Text;
                TheSetupXMLFile.getInstance().profils.Add(profil);
            }
        }
Пример #10
0
        public mailTo()
        {
            TheSetupXMLFile.getInstance().readXML();

            InitializeComponent();

            this.Text            = "Assistant d'envoi de CV";
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox     = false;
            this.MinimizeBox     = true;

            //Ajout des profils dans la comboBox
            for (var i = 0; i < TheSetupXMLFile.getInstance().profils.Count; i++)
            {
                comboBox1.Items.Add(TheSetupXMLFile.getInstance().profils[i].profilName);
            }

            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = TheSetupXMLFile.getInstance().selectionProfil;
            }
        }
 private void subjectBox_TextChanged(object sender, EventArgs e)
 {
     TheSetupXMLFile.getInstance().profils[profilsList.SelectedIndex].subject = subjectBox.Text;
 }