public partial class destekpaneli : UserControl { public destekpaneli() { InitializeComponent(); } private void button39_Click(object sender, EventArgs e) { string kullaniciEposta = epostaText.Text; // Veritabanına bağlan string connetionString = "Data Source=NICHT;Initial Catalog=otomasyon;Integrated Security=True"; SqlConnection connection = new SqlConnection(connetionString); SqlCommand command = new SqlCommand("SELECT COUNT(*) FROM kullGiris WHERE eposta=@eposta", connection); command.Parameters.AddWithValue("@eposta", kullaniciEposta); connection.Open(); int kullaniciSayisi = (int)command.ExecuteScalar(); connection.Close(); if (kullaniciSayisi == 0) { // Kullanıcı kayıtlı değil, hata mesajı göster MessageBox.Show("Böyle bir kullanıcı kayıtlı değil."); return; } if (string.Equals(kullaniciEposta, epostaText.Text, StringComparison.OrdinalIgnoreCase)) { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("outlook.com", 587); mail.From = new MailAddress("laclothing34@hotmail.com"); mail.To.Add("laclothing34@hotmail.com"); mail.Subject = "Yeni bir destek talebi oluşturuldu"; mail.Body = "Kullanıcı e-posta adresi: " + kullaniciEposta + "\n" + "Destek talebi konusu: " + konuText.Text + "\n" + "Destek talebi mesajı: " + mesajText.Text; SmtpServer.Host = "smtp.outlook.com"; SmtpServer.UseDefaultCredentials = false; SmtpServer.Credentials = new NetworkCredential("laclothing34@hotmail.com", "2121422a"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); MessageBox.Show("Destek talebi başarıyla oluşturuldu."); } else { MessageBox.Show("Farklı bir E-Posta adresi. Lütfen kendi E-Posta adresinizi girin."); } }