yapamadım güncel kodum böyle
` public void SendMail(string mail)
{
UsersDataBase usersDataBase = new UsersDataBase();
string query = "Select UserName,UserPassword From Users Where Mail='"+mail+"'";
command = new SqlCommand(query, connection);
connection.Open();
sdr = command.ExecuteReader();
if (sdr.Read())
{
MailMessage ePosta = new MailMessage();
ePosta.From = new MailAddress("@gmail.com");
ePosta.To.Add(mail);
ePosta.Subject = "Şifre bilgilendirme";
ePosta.Body = "Kullanıcı adınız:admin\n Sifreniz:1234";
SmtpClient smtp = new SmtpClient();
smtp.Credentials = new System.Net.NetworkCredential("@gmail.com", "123");
smtp.Port = 587;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
smtp.Send(ePosta);
}
else
{
MessageBox.Show("hatalı");
}
connection.Close();`