I am trying to send automated email when ever some body register on my website. There is no exception whenever I register myself on website (Local server) . I also added using system.Net.Mail and web.Config script a. Following is my piece of ASP.NET code:
public void SendWelcomeMail()
{
string EmailTO = TextBoxEmail.Text;
string EmailFrom = "exampleEmail@gmail.com";
string Pass = TextBoxPassword.Text;
try
{
MailMessage message = new MailMessage();
message.From = new MailAddress(EmailFrom);
message.To.Add(new MailAddress(EmailTO));
message.Subject = "Welcome";
message.Body = "You are now registered with your email ID "+EmailTO;
message.Body = "Your Password is "+Pass;
SmtpClient client = new SmtpClient();
client.Send(message);
}
catch
{
Response.Write("Sorry there is an exception. Some thing must be wrong");
}
}