我试图在 asp.net 中发送简单的邮件。它不起作用。
这是代码:
protected void Button2_Click(object sender, EventArgs e)
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gorenparmak.com");
mail.From = new MailAddress("radyo@gorenparmak.com");
mail.To.Add("radyo@gorenparmak.org");
mail.Subject = "Test Mail - 1";
mail.Body = "mail with attachment";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("radyo@gorenparmak.com", "write password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
我运行它时产生的错误:
无法解析远程名称:“smtp.gorenparmak.com”
我该如何解决这个问题?