[code lang=”csharp”]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net.Mail;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnTemizle_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
}
private void btnGönder_Click(object sender, EventArgs e)
{
try
{
if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "")
{
MailMessage mail = new MailMessage();
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(textBox1.Text, textBox2.Text);
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
mail.To.Add(textBox4.Text);
mail.From = new MailAddress(textBox1.Text);
mail.Subject = textBox5.Text;
mail.Body = textBox3.Text;
client.Send(mail);
MessageBox.Show("Mesaj gönderildi", "Bildirim", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else MessageBox.Show("Lütfen Boş alanları dolduralım", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch
{
MessageBox.Show("Gmail Adı veya şifre hatalı", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
[/code]
GİRİŞ EKRANI
GELEN KUTUSU
MESAJ



gmail adresi veya şifre hatalı diye bir uyarı alıyorum ?
@ismailcan
hotmailde geçerli olmuyor sadece gmail de geçerli.
Arkadaşlar bu gmailden göndermek içindir ama isterseniz hotmailden göndermede yapabilirsin isterseniz yahoodan göndermede yapabilirsiniz eğer böle yapmak isterserseniz küçük bir kod değişimi olması gerekiyor client hostunu ben gmaile göre ayarladım siz internetten araştırıp hotmailin kini oraya yazarsanız herşey düzelecektir
hangi textbox gmail, şifre, konu mesaj görevlerini yapıyor yazarmısınız
SMTP sunucusu güvenli bir bağlantı gerektiriyor veya istemcinin kimliği doğrulanmadı. Sunucu yanıtı şöyleydi: 5.5.1 Authentication Required. Learn more at nasıl duzeltebilirim
Ayşegül:
Hangi maili kullanıyorsan onun Smtp ayarları doğru olmayabilir.
Çok teşekkürler eline sağlık hocam