aspx.cs page
protected void SendMailtoEmployee()
{
var fromAddress = "ekanathareddy@suviva.net";
var toAddress = txtEmail.Text.ToString();
const string fromPassword = "suviva123";
string subject = "Hi! Mail From Dialಮಾಡಿ.com, Your Login Details";
string body = " WelCome to Dialಮಾಡಿ.com. Your Login Details are Username is :" + txtUsername.Text + " and Password is :" + txtPassword.Text + "";
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
smtp.Send(fromAddress, toAddress, subject, body);
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
ds = bal.ForgottenPassword(txtEmail.Text);
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
txtUsername.Text = ds.Tables[0].Rows[0][0].ToString();
txtPassword.Text = ds.Tables[0].Rows[0][1].ToString();
SendMailtoEmployee();
lblmsg.Text = "Your Login Details has been sent to Your Mail Id Successfully...";
txtEmail.Text = string.Empty;
}
}
else
lblerrmsg.Text = "Deatails was not found.";
}
catch (Exception ex)
{
lblerrmsg.Text = ex.Message;
}
}
protected void SendMailtoEmployee()
{
var fromAddress = "ekanathareddy@suviva.net";
var toAddress = txtEmail.Text.ToString();
const string fromPassword = "suviva123";
string subject = "Hi! Mail From Dialಮಾಡಿ.com, Your Login Details";
string body = " WelCome to Dialಮಾಡಿ.com. Your Login Details are Username is :" + txtUsername.Text + " and Password is :" + txtPassword.Text + "";
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
smtp.Send(fromAddress, toAddress, subject, body);
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
ds = bal.ForgottenPassword(txtEmail.Text);
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
txtUsername.Text = ds.Tables[0].Rows[0][0].ToString();
txtPassword.Text = ds.Tables[0].Rows[0][1].ToString();
SendMailtoEmployee();
lblmsg.Text = "Your Login Details has been sent to Your Mail Id Successfully...";
txtEmail.Text = string.Empty;
}
}
else
lblerrmsg.Text = "Deatails was not found.";
}
catch (Exception ex)
{
lblerrmsg.Text = ex.Message;
}
}
No comments:
Post a Comment