Gmail을 사용하여 이메일을 보내려합니다. 이것이 올바르게 작동하지 않는 이유가 확실하지 않습니다. 아래는 던져진 오류의 스크린 샷입니다. 여기 아래Gmail에서 이메일을 보내지 못하게하기
내 메일 클라이언트를 설정하는 코드입니다.
string body = File.ReadAllText(@"C:\Data\MailTemplates\welcome.html");
MailMessage message = new MailMessage();
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 587;
client.Credentials = new System.Net.NetworkCredential("sean.shydow", "password");
client.EnableSsl = true;
message.From = new MailAddress("[email protected]");
message.IsBodyHtml = true;
ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
message.To.Add("[email protected]");
message.Subject = subject.Text;
message.SubjectEncoding = System.Text.Encoding.Unicode;
message.Body = body;
message.BodyEncoding = System.Text.Encoding.Unicode;
예외의 콘솔 그림을 보려면 마우스 오른쪽 버튼을 클릭하고 새 창이나 탭에서 엽니 다. –
적어도 호출 스택의 처음 몇 줄이 텍스트로 포함 된 경우 도움이됩니다. – ChrisF
@Sean 대신 예외 텍스트를 게시 할 수 없습니까? 콘솔 앱의 스크린 샷은별로 유용하지 않습니다 ... –