我想向在我的网站上注册的用户发送邮件。我有一个名为 muratakarsu@bisorumvar.net 的邮件服务器,我的代码如下
protected void btnSave_Click(object sender, EventArgs e)
{
SmtpClient SmtpServer = new SmtpClient("muratakarsu@bisorumvar.net")
MailMessage mailim = new MailMessage();
mailim.From = new MailAddress("muratakarsu@bisorumvar.net");
mailim.To.Add("registered user's mail");
mailim.Subject = "Activation code";
mailim.IsBodyHtml = true;
mailim.Body = "<a href=\"http://www.bisorumvar.net/Uyelik_Onayla.aspx?mail=" + mail + "\">Please click this link to activate your registiration</a>";
SmtpServer.Port = 587;
SmtpServer.UseDefaultCredentials = true;
SmtpServer.Credentials = new System.Net.NetworkCredential("muratakarsu@bisorumvar.net", "xxx");
SmtpServer.EnableSsl = false;
SmtpServer.Send(mailim);
}
当我单击按钮时,它没有显示任何错误,但它没有将邮件发送到用户的邮件地址,所以哪里有任何错误,请大家帮忙