我是想点击一个按钮,就把定义好的邮件信息发过去,
有些服务器限制不严格的话,不用验证发信的用户名和密码就能把信给发过去,就像下面的代码一样
protected void Button1_Click(object sender, EventArgs e)
{
MailAddress from = new MailAddress("aaa@aaa.com");
MailAddress to = new MailAddress("www.summoner@163.com");
MailMessage message = new MailMessage(from, to);
message.Subject = "Test mail";
message.Body = "Using this feature, you can send an e-mail message from an application very easily.";
SmtpClient client = new SmtpClient("mail.sys-sh.com",25);
client.Send(message);
this.Button1.Text = "OK";
} 但是有些服务器限制比较严格,需要发件人给出邮箱用户名和密码,就像先登录邮箱网站输入用户名和密码一样,现在我想在按钮单击事件里面给加上用户名和密码的验证信息,要怎么样加?