Create a TextBox to generate a password
On Submit Button Include the following code...
Step 1: Declare the System.Net.Mail namespace
using System.Net.Mail;
Step 2: Create a MailMessage object. This class contains the actual message you want to send. There are four overloaded constructors provided in this class. We will be using
public MailMessage ( string from, string to, string subject, string body )
The constructor of this MailMessage class is used to specify the sender email, receiver email, subject, body.
MailMessage message = new MailMessage ("abc@somedomain.com","UserMailId","Testing","TextBox1.Text.ToString(););
Step 3:After creating a message, use the SmtpClient to send the email to the specified SMTP server. I will be using ‘localhost’ as the SMTP server.
SmtpClient client = new SmtpClient("localhost");
client.Send(message);