Example #1
0
        public Task Execute(IJobExecutionContext context)
        {
            // get the details of the mail to sent
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri(url + "sendEmail");
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage response = client.GetAsync($"sendEmail").Result;

            if (response.IsSuccessStatusCode)
            {
                var          result    = response.Content.ReadAsStringAsync().Result;
                List <Email> emailList = JsonConvert.DeserializeObject <List <Email> >(result);
                if (emailList != null && emailList.Count > 0)
                {
                    //send the email by mds
                    emailList.ForEach(email =>
                    {
                        Dictionary <string, object> information = new Dictionary <string, object>
                        {
                            { "projectName", email.projectName },
                            { "endDate", email.endDate.Date }
                        };
                        MessageDistributionManager.SendEmail(1091, email.employeesEmail, information);
                    }
                                      );
                }
            }
            return(null);
        }
        public static bool sendEmail(string sub, string body, string email)
        {
            Dictionary <string, object> information = new Dictionary <string, object>
            {
                { "sub", "sub" },
                { "body", "body" }
            };

            MessageDistributionManager.SendEmail(1091, "*****@*****.**", null);
            return(true);
        }
Example #3
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     //  HomeLogic.sendEmail("bsd", "trust in hashem!!!", "*****@*****.**");
     Dictionary <string, object> information = new Dictionary <string, object>
     {
         { "sub", "sub" },
         { "body", "body" }
     };
     string s   = MessageDistributionManager.SendEmail(1092, "*****@*****.**", information);
     string rrs = s;
 }
 public HttpResponseMessage SendMsg([FromBody] JObject data)
 {
     if (ModelState.IsValid)
     {
         Dictionary <string, object> information = new Dictionary <string, object>
         {
             { "sub", (string)data["sub"] },
             { "body", (string)data["body"] }
         };
         string result = MessageDistributionManager.SendEmail(1092, "*****@*****.**", information);
         return(result == "success" ? new HttpResponseMessage(HttpStatusCode.OK)
         {
             Content = new ObjectContent <String>("yes", new JsonMediaTypeFormatter())
         } :
                new HttpResponseMessage(HttpStatusCode.BadRequest)
         {
             Content = new ObjectContent <String>("Can not send Email", new JsonMediaTypeFormatter())
         });
     }
     return(Global.ErrorList(ModelState));
 }
Example #5
0
 public static string SendMailMDS(List <string> to, int templateId, List <MDS.Connector.Attachment> attachments = null, List <string> cc = null, List <string> bcc = null, Dictionary <string, object> replacments = null)
 {
     MessageDistributionManager.SendEmail(templateId, to, replacments);
     return("");
 }