EMAIL LIBRARY INCLUDE
using System.Net.Mail;
Send Button Code
{
MailMessage mailMessage = new MailMessage(); //set the Mail Property to,from,body
SmtpClient stp = new SmtpClient(); // set the credential
mailMessage.To.Add(txtemail.Text);
mailMessage.From = new MailAddress("YOUR EMAIL ID");
mailMessage.Subject = "OTP Verification - Demo Session Registration";
mailMessage.Body = @"
<html>
<head></head>
<body style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>
<p>Dear Student,</p>
<p>
Thank you for registering for the <b>Yoga Demo Session</b> with
<b>Globeyog</b>.
</p>
<p>
To complete your registration, please verify your email address using the
One-Time Password (OTP) below:
</p>
<p style='font-size:20px; color:#0066CC;'>
<b>Your OTP: " + n.ToString() + @"</b>
</p>
<p>
This OTP is valid for <b>10 minutes</b>.
Please do not share it with anyone.
</p>
<p>
If you did not request this registration, please ignore this email.
</p>
<p>
Thank you for choosing <b>Globeyog</b>.
We look forward to welcoming you to the Yoga Demo Session.
</p>
<br />
<p>
Regards,<br /><br />
<b>Team Globeyog</b><br />
<br />
</p>
</body>
</html>";
mailMessage.IsBodyHtml = true;
//smtpClient.Send(mailMessage);
stp.Host = "smtp.gmail.com"; // host is reprensenting mail server
stp.Credentials = new System.Net.NetworkCredential("youremailid@gmail.com", "APP PASSWORD");
stp.EnableSsl = true; //sucessful send message server security licences
// send your mail using send()
stp.Send(mailMessage);
}