Esempio n. 1
0
        private void mnuSend_Click(object sender, EventArgs e)
        {
            string s_message;

            string [] s_emails;


            s_message = (File.OpenText(txtContent.Text)).ReadToEnd();

            mail_count = 0;
            foreach (ListViewItem lv in mainlist.Items)
            {
                if (lv.Checked)
                {
                    /*if (!File.Exists(lv.SubItems[2].Text))
                     * {
                     *  lv.SubItems[3].Text = "No attachment!";
                     *  continue;
                     * }*/

                    if (lv.SubItems[5].Text.Length == 0)
                    {
                        lv.SubItems[5].Text = "No email address!";
                        continue;
                    }


                    s_emails = lv.SubItems[5].Text.Split(',', ';');


                    foreach (string se in s_emails)
                    {
                        lv.SubItems[6].Text   = "Sending...";
                        mailers[mail_count]   = new cmailer(nc);
                        msgs[mail_count]      = new MailMessage(txtEmail.Text, se);
                        msgs[mail_count].From = new MailAddress(txtEmail.Text, cbName.Text);

                        msgs[mail_count].Body         = s_message;
                        msgs[mail_count].Subject      = txtSubject.Text + " FOR " + lv.Text.ToUpper();
                        msgs[mail_count].IsBodyHtml   = true;
                        msgs[mail_count].BodyEncoding = ASCIIEncoding.Default;

                        //Attachment a = new Attachment(lv.SubItems[2].Text);
                        //msgs[mail_count].Attachments.Add(a);

                        lvx t = new lvx();
                        t.lvi      = lv;
                        t.rowindex = (int)mail_count;
                        mailers[mail_count].sendit(msgs[mail_count], t);
                        mail_count++;
                    }
                }
            }
        }
Esempio n. 2
0
 public void sendit(MailMessage m, lvx token)
 {
     mc.SendAsync(m, token);
 }