我想用 c# 发送电子邮件。我实现了所有代码但收到错误......它
指出了 smtp.port=465 上的错误;我也使用代码来指定主机。但我不明白为什么我我收到这种类型的错误??????
.aspx 代码
public void click(object sender, EventArgs sd)
{
try
{
System.Net.Mail.MailMessage message = new
System.Net.Mail.MailMessage();
//smessage.To.Add(TextBox1.Text);
message.To.Add(System.Net.Mail.MailAddress(TextBox1.Text));
message.Subject = "This is the Subject line";
message.From = new System.Net.Mail.MailAddress(TextBox2.Text);
message.Body = "This is the message body";
System.Net.Mail.SmtpClient smtp = new
System.Net.Mail.SmtpClient("yoursmtphost");
smtp.Host = "smtp.yahoo.mail.com";
smtp.Port = 465;
smtp.Send(message);
}
catch (Exception gf)
{
}
}