jeudi 26 juillet 2018

how to implement Email conformation in regestering user by web api and jquery

Hello Everyone I am making a web application of asp.net web api in which i want to apply email checking function at register time how i can implement it i have seen many website but i cant not get exact result please help me i have read code from microsoft website but i did not understand the code and how to apply it code is here

Go to the Azure SendGrid sign up page and register for a free SendGrid account. Configure SendGrid by adding code similar to the following in App_Start/IdentityConfig.cs:

C#

Copy
public class EmailService : IIdentityMessageService
{
   public async Task SendAsync(IdentityMessage message)
   {
      await configSendGridasync(message);
   }

   // Use NuGet to install SendGrid (Basic C# client lib) 
   private async Task configSendGridasync(IdentityMessage message)
   {
      var myMessage = new SendGridMessage();
      myMessage.AddTo(message.Destination);
      myMessage.From = new System.Net.Mail.MailAddress(
                          "Joe@contoso.com", "Joe S.");
      myMessage.Subject = message.Subject;
      myMessage.Text = message.Body;
      myMessage.Html = message.Body;

      var credentials = new NetworkCredential(
                 ConfigurationManager.AppSettings["mailAccount"],
                 ConfigurationManager.AppSettings["mailPassword"]
                 );

      // Create a Web transport for sending email.
      var transportWeb = new Web(credentials);

      // Send the email.
      if (transportWeb != null)
      {
         await transportWeb.DeliverAsync(myMessage);
      }
      else
      {
         Trace.TraceError("Failed to create Web transport.");
         await Task.FromResult(0);
      }
   }
}
You'll need to add the following includes:

C#

Copy
using SendGrid;
using System.Net;
using System.Configuration;
using System.Diagnostics;

please help me I am needy and begginer




Aucun commentaire:

Enregistrer un commentaire