我試圖發送郵件,但這個代碼引發錯誤「發送失敗」在C#中發送電子郵件?
MailMessage MailMesaji = new MailMessage();
MailMesaji.Subject = "subject";
MailMesaji.Body = "mail body";
//MailMesaji.BodyEncoding = Encoding.GetEncoding("Windows-1254"); // Turkish Character Encoding
MailAddress mdrom = new MailAddress("[email protected]");
MailMesaji.From = mdrom;
MailMesaji.To.Add(new MailAddress("[email protected]"));
System.Net.Mail.SmtpClient Smtp = new SmtpClient();
Smtp.Host = "mail.verydindai.com"; // for example gmail smtp server
Smtp.EnableSsl = true;
Smtp.Port = 465;
Smtp.Credentials = new System.Net.NetworkCredential("amit.pandey", "1234567");
Smtp.Send(MailMesaji);
PLZ告訴我的解決方案?如果你有另一個解決方案告訴我?
什麼是你得到確切的例外? – 2010-06-21 10:39:11