我做了一个发邮件的小程序,可是为什么收邮件时,邮件是在垃圾邮件里,而不是在收件箱里呢?
代码如下,请高手解达(我用的是.NET2003)
protected void AddBtn_Click(object sender, EventArgs e)
{
MailMessage mail = new MailMessage();
string to = this.toTxt.Text;//收信人
string send = this.sendTxt.Text;//发信人
string body = this.bodyTxt.Text;//标题
string subject = this.subjectTxt.Text;//正文
mail.To = to;
mail.From = send;
mail.Body = body;
mail.Subject = subject;
mail.BodyFormat = MailFormat.Text;
string file = this.attach.Value;
if (file != "")
mail.Attachments.Add(new MailAttachment(file));
this.send(mail);
alert("发送成功!");
}
/*
* 用来发送Email;
*/
private void send(MailMessage mail)
{
SmtpMail.Send(mail);
}
private void alert(string param)
{
this.Response.Write("<script language='javascript'>alert('" + param + "!!!'); </script>");
}
}