1st Video List : Xamarin with WebAPI
2nd Video List : Xamarin with WebServices(WCF)
This two video list is not in English version but we use coding to understand.
1st Video List : Xamarin with WebAPI 2nd Video List : Xamarin with WebServices(WCF) First Download the Sample Source Code about SendGrid and Publish to Azure.
https://github.com/cheahengsoon/Xamarin.Form-Enterprise-Demo/tree/master/SendGridSample-master Reminder: Please install SendGrid Nuget The API is in Controllers Folder > EmailController.cs [HttpGet] [Route("api/SendMail")] public string SendMail(string email, string content) { // Create the email object first, then add the properties. var myMessage = new SendGridMessage(); // Add the message properties. myMessage.From = new MailAddress("Your Email"); // Add multiple addresses to the To field. List<String> recipients = new List<String> { email }; myMessage.AddTo(recipients); myMessage.Subject = "Testing the SendGrid Library"; myMessage.Text = content; //Add Text bodies // myMessage.Text = "Hello World from " + Environment.MachineName; // Create a Web transport, using API Key NetworkCredential nc = new NetworkCredential("Your SendGrid UserName", "Your SenGrid Account"); var transportWeb = new Web("This string is a SendGrid API key", nc, TimeSpan.FromSeconds(15)); // Send the email. transportWeb.DeliverAsync(myMessage); return "done"; } Then go to your Xamarin.Forms, Forget Password event Handler. private string Uri = "https://XXXX.azurewebsites.net/api/SendMail?"; private void SendEmail(string femail, string fpassword) { var httpClient = new HttpClient(); var result = httpClient.GetAsync($"{Uri}email={femail}&content={"Your Password :" + fpassword}"); DisplayAlert("Forget Password", "Your password had been sent to your email.", "OK"); } |
Archives
June 2020
Categories
All
|