thie article으로 Outlook 2010을 설정하면 yahoo.com에서 이메일을 보내고받을 수 있습니다. 문제없이 잘 작동합니다. yahoo.com에서 이메일을 보내는 중 오류가 발생했습니다.
난 내 응용 프로그램에서 내 이메일을 보낼 수있는 작은 응용 프로그램을 개발하지만 나에게 오류를 준 :"unable to read data from the transport connection:an exist connection was
forcibly closed by the remote host."
내 코드 :
try
{
SmtpClient smtp = new SmtpClient("smtp.mail.yahoo.com", 465);
smtp.UseDefaultCredentials = true;
smtp.EnableSsl = true;
smtp.Credentials = new System.Net.NetworkCredential("myid", "mypass");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
MailMessage mailMessage = new MailMessage();
mailMessage.From = new System.Net.Mail.MailAddress("[email protected]", "blabla");
mailMessage.To.Add(new System.Net.Mail.MailAddress("[email protected]", "[email protected]"));
mailMessage.Subject = "test";
mailMessage.Body = "test";
mailMessage.IsBodyHtml = false;
mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
mailMessage.BodyEncoding = System.Text.Encoding.UTF8;
mailMessage.Priority = MailPriority.High;
smtp.Send(mailMessage);
Console.WriteLine("hooooooooooraaaaaaaaaaaaaaa");
Console.ReadKey();
}
catch (Exception err)
{
Console.WriteLine(err.InnerException.Message);
Console.ReadKey();
return;
}
나는 당신이'Credentials'와 함께'UseDefaultCredentials' 속성을 사용해야한다고 생각하지 않습니다. 'UseDefaultCredentials'를 false로 설정합니다. 이 속성을 사용하면 SmtpClient가 현재 사용자의 시스템 자격 증명을 사용하려고 시도합니다. –
@ Adam smtp.UseDefaultCredentials = false로 테스트했는데 작동하지 않는 것은 같은 오류가 있지만 도움을 주셔서 감사합니다. – motevalizadeh
http : /stackoverflow.com/questions/5092235/c-sharp-smtp-email-sending-code-fails-for-yahoo-mail-but-works-fine-for-other-se –