I want to know how can I send emai from my pc I dont have any server to test my code and I think may be I can use google/yahoo smtp but I dont know how to use them.and I want to know if I use google/yahoo smtp then I can send email to every one? and I dont know what exactly should I put in sc.Credentials = new NetworkCredential(username,password); I put my admin username and password which I defined it in my web.config file in credential tag this is my code:
protected void SendMail(string ma,DataRow dataRow)
{
try
{
string from = "myEmail@yahoo.com";
string subject = "forgotten password";
string body = "name: " + dataRow["user_name"].ToString() + "<br/>" + "familly : " + dataRow["user_familly"].ToString() + "<br/>" + "password : " + dataRow["user_password"].ToString();
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(from, ma, subject, body);
mail.IsBodyHtml = false;
System.Net.Mail.SmtpClient sc = new System.Net.Mail.SmtpClient();
sc.Port = 587;
sc.Host = "smtp.mail.yahoo.com";// "smtp.gmail.com";
sc.EnableSsl = false;
sc.Send(mail);
Label1.ForeColor = System.Drawing.Color.Blue;
Label1.Text = "your password sent";
}
catch (Exception e)
{
Label1.Text = e.ToString();
}
}