好久没写东西了 闲的疼
突然想到没写过发邮件
查了下资料 写了个简单的
MailMessage mymm = new MailMessage();
mymm.From = new MailAddress("邮件地址");
mymm.To.Add(new MailAddress("邮件地址"));
//在这里我只是设置了两个最基本的属性
mymm.Body = "test";
mymm.Subject = "test";
SmtpClient tmp = new SmtpClient("10.225.68.5", 25);
//验证的写法
tmp.Credentials = new System.Net.NetworkCredential("用户名", "密码");
try
{
tmp.Send(mymm);
}
catch(Exception ex)
{
throw ex;
}