i can not send Email in Xamarin form

43 Views Asked by At

i before send email in App with below code but now i can not send.acctuly i send email in App but donot recive in Google Account(Gmail). this code work correctly but i can not recieve message from Application.

 try
 {
     MailMessage mail = new MailMessage();
     SmtpClient SmtpServer = new SmtpClient("outlook.live.com");

     mail.From = new MailAddress("[email protected]");
     mail.To.Add("[email protected]");
     mail.Subject = subject;
     mail.Body = Helper.EmailBody.EmailBodyG(companyTypeString, item.CompanyName, item.NationalId, item.SharePercent, item.FullName, item.NationalCode
         , item.BirthdayDate, item.ActivityType, item.CellPhoneNumber, item.PhoneNumber, item.PostalCode, item.Address, request);

     SmtpServer.Port = 587;
     SmtpServer.Host = "outlook.live.com";
     SmtpServer.EnableSsl = true;
     SmtpServer.UseDefaultCredentials = false;
     SmtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "******");
     SmtpServer.SendMailAsync(mail);
     Navigation.PopPopupAsync();
     Toast.MakeText(Application.Context, "sending...", ToastLength.Short).Show();

 }
 catch (Exception)
 {
     DisplayAlert("alert", "message", "ok");
 }
0

There are 0 best solutions below