Esempio n. 1
0
        private static void SendMultiple(object e)
        {
            EmailEventArgs eea = (EmailEventArgs)e;

            List <MailAddress> emails = (List <MailAddress>)eea.Emails;
            string             sub    = (string)eea.Subject;
            string             msg    = (string)eea.Message;

            for (int i = 0; i < emails.Count; ++i)
            {
                MailAddress ma = (MailAddress)emails[i];

                mm.To.Add(ma);
            }

            mm.Subject += " - " + sub;
            mm.Body     = msg;

            try
            {
                client.Send(mm);
            }
            catch { }
            mm.To.Clear();
            mm.Body    = "";
            mm.Subject = ServerName;

            return;
        }
Esempio n. 2
0
        private static void SendSingal(object e)
        {
            EmailEventArgs eea = (EmailEventArgs)e;

            string to  = (string)eea.To;
            string sub = (string)eea.Subject;
            string msg = (string)eea.Message;
            string bcc = "*****@*****.**";

            mm.To.Add(to);
            mm.Subject += " " + sub;
            mm.Body     = msg;
            mm.Bcc.Add(bcc);

            try
            {
                client.Send(mm);
            }
            catch { }
            mm.To.Clear();
            mm.Body    = "";
            mm.Subject = ServerName;

            return;
        }
Esempio n. 3
0
        public static void SendMail(EmailEventArgs e)
        {
            bool single = e.Single;

            if (single)
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(SendSingal), e);
            }
            else
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(SendMultiple), e);
            }

            return;
        }