Exemple #1
0
        public Guid MailResponse(SendMailResponse request)
        {
            CMDataAccess datatAccess = new CMDataAccess();
            MailResponse requestData = new MailResponse();

            if (request != null)
            {
                requestData.RequestGuid = request.RequestGuid;
                requestData.Token       = request.Token;
                requestData.CreatedDate = DateTime.Now;
                MailResponseDetails mailresponsedetails = null;
                foreach (var varItem in request.Details)
                {
                    mailresponsedetails                 = new MailResponseDetails();
                    mailresponsedetails.MailGuid        = varItem.MailGuid;
                    mailresponsedetails.To              = varItem.To;
                    mailresponsedetails.From            = varItem.From;
                    mailresponsedetails.CC              = varItem.CC;
                    mailresponsedetails.BCC             = varItem.BCC;
                    mailresponsedetails.Status          = varItem.Status;
                    mailresponsedetails.ServiceResponse = varItem.ServiceResponse;
                    mailresponsedetails.CreatedDate     = DateTime.Now;
                    mailresponsedetails.MailResponse    = requestData;
                    requestData.MailResponseDetails.Add(mailresponsedetails);
                }
                return(datatAccess.MailResponse(requestData));
            }
            return(Guid.NewGuid());
        }
Exemple #2
0
        public Guid TextResponse(SendTextResponse request)
        {
            CMDataAccess datatAccess = new CMDataAccess();
            TextResponse requestData = new TextResponse();

            if (request != null)
            {
                requestData.RequestGuid = request.RequestGuid;
                requestData.Token       = request.Token;
                requestData.CreatedDate = DateTime.Now;
                foreach (var varItem in request.Details)
                {
                    TextResponseDetails textresponsedetails = new TextResponseDetails();
                    textresponsedetails.SenderId        = varItem.SenderId;
                    textresponsedetails.From            = varItem.From;
                    textresponsedetails.ServiceResponse = varItem.ServiceResponse;
                    textresponsedetails.Message         = varItem.Message;
                    textresponsedetails.Status          = varItem.Status;
                    textresponsedetails.To           = string.Join(",", varItem.To.ToArray());
                    textresponsedetails.TextResponse = requestData;
                    requestData.TextResponseDetails.Add(textresponsedetails);
                }
                return(datatAccess.TextResponse(requestData));
            }
            else
            {
                return(Guid.Empty);
            }
            //return Guid.NewGuid();
        }
Exemple #3
0
        public SmtpMailService(Guid token)
        {
            var cmDataAccess = new CMDataAccess();
            var registration = cmDataAccess.GetMailRegistration(token);

            smtpClient             = new SmtpClient(registration.Address);
            smtpClient.Credentials = new NetworkCredential(registration.UserName, registration.Password);
            if (registration.Port.HasValue)
            {
                smtpClient.Port = registration.Port.Value;
            }
            smtpClient.EnableSsl = registration.IsSSLEnabled;
        }