Exemple #1
0
        public List <QMailer.Web.TemplateInfo> GetTemplateListByModel(string modelName)
        {
            var httpClient = new RestSharpClient();
            var r          = httpClient.CreateRequest("api/qmailer/templatelistbymodel/" + modelName, RestSharp.Method.GET);
            var result     = httpClient.Execute <List <QMailer.Web.TemplateInfo> >(r);

            return(result);
        }
Exemple #2
0
        public void Send(EmailMessage emailMessage)
        {
            var httpClient = new RestSharpClient();
            var r          = httpClient.CreateRequest("api/qmailer/sendemailmessage", RestSharp.Method.POST);

            r.AddBody(emailMessage);
            httpClient.Execute(r);
        }
Exemple #3
0
        public EmailConfig CreateEmailConfig(string messageId)
        {
            var httpClient = new RestSharpClient();
            var r          = httpClient.CreateRequest("api/qmailer/createemailconfig/" + messageId, RestSharp.Method.GET);
            var result     = httpClient.Execute <EmailConfig>(r);

            return(result);
        }
Exemple #4
0
        public void Send(EmailConfig emailConfig)
        {
            if (emailConfig.Model == null)
            {
                return;
            }

            emailConfig.AssemblyQualifiedTypeNameModel = emailConfig.Model.GetType().AssemblyQualifiedName;

            var httpClient = new RestSharpClient();
            var r          = httpClient.CreateRequest("api/qmailer/sendemailconfig", RestSharp.Method.POST);

            r.AddBody(emailConfig);
            httpClient.Execute(r);
        }
Exemple #5
0
        public string GetPreviewUrl(QMailer.EmailConfig config)
        {
            if (config.Model == null)
            {
                return(null);
            }

            config.AssemblyQualifiedTypeNameModel = config.Model.GetType().AssemblyQualifiedName;

            var httpClient = new RestSharpClient();
            var r          = httpClient.CreateRequest("api/qmailer/previewkey", RestSharp.Method.POST);

            r.AddBody(config);
            var result = httpClient.Execute <Newtonsoft.Json.Linq.JObject>(r);
            var key    = result["messageId"];

            //var key = result.GetType().GetProperty("messageId", System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).GetValue(result, null);
            return(string.Format("http://{0}/qmailer/preview/{1}", GlobalConfiguration.Configuration.ApiUrl.TrimEnd('/'), key));
        }
Exemple #6
0
        public EmailMessage GetEmailMessage(EmailConfig emailConfig)
        {
            if (emailConfig.Model == null)
            {
                return(null);
            }

            emailConfig.AssemblyQualifiedTypeNameModel = emailConfig.Model.GetType().AssemblyQualifiedName;

            var httpClient = new RestSharpClient();
            var r          = httpClient.CreateRequest("api/qmailer/emailmessage", RestSharp.Method.POST);



            r.AddBody(emailConfig);
            var result = httpClient.Execute <EmailMessage>(r);

            return(result);
        }