Exemple #1
0
        public void Process(string input)
        {
            XDocument doc = null;

            //HACK: checking c:\ as a test.. remove for production
            if (input.Contains("C:\\")) // testing from file
                doc = XDocument.Load(new StreamReader(input));
            else
                doc = XDocument.Load(new StringReader(input));

            Process(doc);

            // Can this be Parrell.For?
            foreach (string item in _ids)
            {
                int i = int.Parse(item);

                PgpEntities svc = new PgpEntities(new Uri(SERVICE_URI));

                var query = from card in svc.Cards
                            where card.CardId == i
                            select card;

                try
                {
                    //
                }
                catch (Exception ex)
                {

                }

                foreach (var card in query)
                {
                    SendMail(card);

                    card.IsSent = true;
                    svc.UpdateObject(card);
                    svc.SaveChanges();
                }
            }
        }
Exemple #2
0
        private void SendMail(Card card)
        {
            PgpEntities svc = new PgpEntities(new Uri(SERVICE_URI));
            var query = from m in svc.MailSettings select m;
            MailSetting settings = query.First();

            //TODO: using my email address for my relay.. replace with BF relay info
            MailMessage msg = new MailMessage(
                new MailAddress(card.RecipientEmail),
                new MailAddress("*****@*****.**")
                );

            if(settings.CC != null)
                msg.CC.Add(new MailAddress(settings.CC));

            msg.Subject = settings.Subject;

            //TODO: Check URL for paint georgia pink
            string body = settings.Body + "\n" + settings.PickupURL + "?CardId=" + card.CardId;
            msg.Body = body;

            SmtpClient mailer = new SmtpClient(settings.SmtpServer,80);

            mailer.Credentials = new System.Net.NetworkCredential(settings.EmailAccountName, settings.EmailAccountPassword);

            mailer.Send(msg);
        }