0
我試圖發送簡單的郵件在asp.net.it不起作用。ASP.NET簡單郵件發送使用C#
這裏是代碼:
當我運行它產生protected void Button2_Click(object sender, EventArgs e)
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gorenparmak.com");
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Test Mail - 1";
mail.Body = "mail with attachment";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "write password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
錯誤:
遠程名稱無法解析:smtp.gorenparmak.com'
如何我能解決這個問題嗎?
這似乎是DNS的問題。首先,這個域是通過主機購買或配置的(例如)? – Rolice
您是否嘗試過使用IP地址而不是DNS名稱? – Kane
嘗試ping smtp.gorenparmak.com並查看是否可以連接遠程服務器。 –