// GET: api/Queue/5 USE GET FOR TESTING ONLY
        //this is going to be post

        //7
        //851255a1-213c-4299-a50b-57a06f4a2ed0

        // http://localhost:62902/api/queue/
        //[System.Web.Http.HttpPost]
        public string Get(int id, string apiKey)

        {
            if (apiKey == SmtpFactory.GetApiKey(id).ToString())
            {
                var mailFrom    = new MailAddress("*****@*****.**");
                var mailTo      = new MailAddress("*****@*****.**");
                var mailMessage = new MailMessage(mailFrom, mailTo);


                mailMessage.Body    = "Testing body message";
                mailMessage.Subject = "Another Test";

                //C:\files/file.jpg

                ////upload files here////


                mailMessage.Headers.Add(Constant.OrganizationId, id.ToString());

                var queueId = SmtpFactory.InsertQueueMessage(mailMessage);
                mailMessage.Headers.Add(Constant.QueueId, queueId.ToString());

                //STOP

                //ADD new service to send OR Create function to look use QueueId
                //EmailService
                //SmtpFactory.SendMessage(mailMessage);

                return("");
            }
            return("Wrong ApiKey");
        }
Exemple #2
0
        // GET api/<controller>/5 USE GET FOR TEST PURPOSE ONLY
        public string Get(string id)
        {
            var queueId = Guid.Parse(id);

            SmtpFactory.RemoveQueueMessage(queueId);

            return("value");
        }
        // POST: api/Queue
        public string Post(MailMessage mailMessage)
        {
            var queueId = SmtpFactory.InsertQueueMessage(mailMessage);

            mailMessage.Headers.Add(Constant.QueueId, queueId.ToString());

            SmtpFactory.SendMessage(mailMessage);

            return(queueId.ToString());
        }
Exemple #4
0
        private void SendQueue(object sender, System.Timers.ElapsedEventArgs e)
        {
            _timer.Stop();


            var messageIds = SmtpFactory.GetAllMessageIds();

            foreach (Guid item in messageIds)
            {
                var _message = SmtpFactory.GetMessage(item);
                SmtpFactory.SendMessage(_message);
            }

            _timer.Start();
        }
Exemple #5
0
        // POST api/<controller>
        public void Post(string qid)
        {
            var queueId = Guid.Parse(qid);

            SmtpFactory.RemoveQueueMessage(queueId);
        }