#region 电子邮件
public static bool webMail(string host, int port, string uid, string pwd, bool ssl, string from, string to, string subject, string body)
{
//string str="成功";
System.Net.Mail.SmtpClient mail = new System.Net.Mail.SmtpClient();
mail.Host = host;
mail.Port = port;
mail.Credentials = new System.Net.NetworkCredential(uid, pwd);
mail.EnableSsl = ssl;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from, to);
message.Body = body;
message.Subject = subject;
message.SubjectEncoding = System.Text.Encoding.GetEncoding("gb2312");
message.BodyEncoding = System.Text.Encoding.GetEncoding("gb2312");
message.IsBodyHtml = true;
try
{
mail.Send(message);
message.Dispose();
return true;
//return str;
}
catch (Exception ex)
{
message.Dispose();
return false;
//return ex.ToString();
}
}
#endregion