Esempio n. 1
0
        public void SendWelcome(UserDto userDto)
        {
            using (HttpClient client = new HttpClient())
            {
                try
                {
                    client.BaseAddress = new Uri("http://www.acgelektronik.com/evarlikMailSend.php?token=ae7635abfe63772042f1965d50f07d09");

                    var mailDto = new MailDto()
                    {
                        Body    = WelcomeMailTemplate,
                        Name    = userDto.Name,
                        Subject = "E-Varlik Hoş Gelidiniz",
                        To      = userDto.Mail
                    };

                    var clientDtoJson = JsonConvert.SerializeObject(mailDto);
                    var content       = new StringContent(clientDtoJson, Encoding.UTF8, "application/json");

                    var responseMessageR = client
                                           .PostAsync("evarlikMailSend.php?token=ae7635abfe63772042f1965d50f07d09", content)
                                           .ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
                    responseMessageR.Wait();
                    HttpResponseMessage responseMessage = responseMessageR.Result;
                    var resR = responseMessage.Content.ReadAsStringAsync();
                    resR.Wait();
                    var res = resR.Result;
                }
                catch (Exception e)
                {
                }
            }
        }
Esempio n. 2
0
        public void SendForgotPassword(UserDto userDto)
        {
            using (HttpClient client = new HttpClient())
            {
                try
                {
                    client.BaseAddress = new Uri("http://www.acgelektronik.com/evarlikMailSend.php?token=ae7635abfe63772042f1965d50f07d09");

                    var temmplate = ForgotPasswordTemplate.Replace("__name__", userDto.Name);
                    temmplate = temmplate.Replace("__surname__", userDto.Surname);
                    temmplate = temmplate.Replace("__password__", userDto.Password);

                    var mailDto = new MailDto()
                    {
                        Body    = temmplate,
                        Name    = userDto.Name,
                        Subject = "E-Varlik Şifre Yenileme Talebi",
                        To      = userDto.Mail
                    };

                    var clientDtoJson = JsonConvert.SerializeObject(mailDto);
                    var content       = new StringContent(clientDtoJson, Encoding.UTF8, "application/json");

                    var responseMessageR = client
                                           .PostAsync("evarlikMailSend.php?token=ae7635abfe63772042f1965d50f07d09", content)
                                           .ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
                    responseMessageR.Wait();
                    HttpResponseMessage responseMessage = responseMessageR.Result;
                    var resR = responseMessage.Content.ReadAsStringAsync();
                    resR.Wait();
                    var res = resR.Result;
                }
                catch (Exception e)
                {
                }
            }
        }