C# Form Projeleri 112 – OBS Mail Gönderme Uygulaması v1.0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Obs_Mail_Gönderme { public partial class Form1 : Form { #region Tanımlamalar Personel personel = new Personel(); Öğrenci öğrenci = new Öğrenci(); public static string[] personelno = new string[20]; public static string[] personelşifre = new string[20]; public static string[] öğrencino = new string[20]; public static string[] öğrencişifre = new string[20]; public static string[] öğrencimail = new string[20]; public static string[] mailşifre = new string[20]; #endregion #region Değişkenler public static string personelnoo,personelşifree,öğrencinoo,öğrencişifree; #endregion public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { personelno[0] = "1111"; personelşifre[0] = "1111"; öğrencino[0] = "1111"; öğrencişifre[0] = "1111"; öğrencimail[0] = "muratbilginer09@gmail.com"; mailşifre[0] = "şifre"; } private void button1_Click(object sender, EventArgs e) { int a = 0; int d = 0; int b = -1; int c = -1; personelnoo = textBox1.Text; personelşifree = textBox2.Text; foreach (string no in personelno) { b++; if (personelnoo==no) { a++; break; } } foreach (string sifre in personelşifre) { c++; if (personelşifree == sifre) { d++; break; } } if (b==c && a!=0) { this.Hide(); personel.ShowDialog(); this.Show(); } else { label5.Text = "Yanlış Personel No veya Şifre girdiniz."; } } private void button2_Click(object sender, EventArgs e) { int k = 0, f=0, g=-1, h=-1; öğrencinoo = textBox3.Text; öğrencişifree = textBox4.Text; foreach (string no in öğrencino) { g++; if (öğrencinoo == no) { k++; break; } } foreach (string sifre in öğrencişifre) { h++; if (öğrencişifree == sifre) { f++; break; } } if (g == h && k != 0) { this.Hide(); öğrenci.ShowDialog(); this.Show(); } else { label6.Text = "Yanlış Öğrenci No veya Şifre girdiniz."; } } private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Obs_Mail_Gönderme { public partial class Öğrenci : Form { public Öğrenci() { InitializeComponent(); } private void Öğrenci_Load(object sender, EventArgs e) { label1.Text = Form1.öğrencinoo; label3.Text = Personel.mailgönderildimi.ToString(); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; using System.Net.Mail; using System.Net.Security; using System.Net.Sockets; namespace Obs_Mail_Gönderme { public partial class Personel : Form { #region Değişkenler int a = 1; public static int mailgönderildimi = 0; #endregion public Personel() { InitializeComponent(); } private void Personel_Load(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { if (textBox1.Text!="" && textBox2.Text!="" &&textBox3.Text!="" &&textBox4.Text!="") { Form1.öğrencino[a]=textBox1.Text; Form1.öğrencişifre[a]=textBox1.Text; Form1.öğrencimail[a]=textBox1.Text; Form1.mailşifre[a]=textBox1.Text; label5.Text = "Kayıt Başarılı"; a++; } else { label5.Text = "Boş alan bıramazsınız"; } } private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < Form1.öğrencino.Length; i++) { if (Form1.öğrencimail[i]!=null) { try { SmtpClient baglanti = new SmtpClient(); MailMessage mesaj = new MailMessage(); mesaj.To.Add("buraya bir mail adresi yazılacak");// niz herhangi bir hesap, hotmail, isim@alanadi.com vs hesap farketmez mesaj.From = new MailAddress(Form1.öğrencimail[i]); //nderi yapılacak, gmail hesabı mesaj.Subject = textBox5.Text; mesaj.IsBodyHtml = true; mesaj.Body = richTextBox1.Text; NetworkCredential guvenligonderi = new NetworkCredential(Form1.öğrencimail[i], Form1.mailşifre[i]);//kullanıcı adı ve şifreniz baglanti.Credentials = guvenligonderi; baglanti.Port = 587; //gmail port nurası Türkiye için 587 baglanti.Host = "smtp.gmail.com"; baglanti.EnableSsl = true; baglanti.Send(mesaj); } catch (Exception) { } } else { mailgönderildimi++; break; } } } } } |