Kod:
Mail göndericimail = db.Mail.Where(x => x.mail1 == m.gönderen).SingleOrDefault();
SmtpClient client = new SmtpClient();
MailAddress from = new MailAddress(göndericimail.mail1);
MailAddress to = new MailAddress(m.gönderilen);//bizim mail adresi
MailMessage msg = new MailMessage(from, to);
msg.IsBodyHtml = true;
msg.Subject = m.konu;
msg.Body += göndericimail.mail1 + " " + to + "
" + m.mail;
NetworkCredential info = new NetworkCredential(göndericimail.mail1, göndericimail.Sifre);
client.Port = Convert.ToInt32(göndericimail.Port);
client.Host = göndericimail.Host.ToString();
client.EnableSsl = true;
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
client.Credentials = info;
client.Send(msg);
Hata:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. s1sm1600939ywa.67 - gsmtp
Port Değiştirdiğimde ise:
Unable to read data from the transport connection: net_io_connectionclosed.