//身份验证 if (!sfrom.ToLower().Contains("hotmail") && !sfrom.ToLower().Contains("hexun")) { client.Credentials = new NetworkCredential(sSMTPuser, sSMTPpass); } client.DeliveryMethod = SmtpDeliveryMethod.Network; if (sfrom.ToLower().Contains("gmail")) { client.EnableSsl = true; client.Port = 587; } if (sfrom.ToLower().Contains("hexun")) { client.Credentials = new NetworkCredential(sSMTPuser, sSMTPpass); // client.Credentials = new NetworkCredential(sfrom, sSMTPpass); } if (sfrom.ToLower().Contains("yahoo")) { client.Port = 587; } if (sfrom.ToLower().Contains("hotmail")) { client.EnableSsl = true; client.Credentials = new NetworkCredential(sfrom, sSMTPpass); client.Port = 25; }