您好我想用 ASP.NET 发送邮件,但我想通过代理服务器发送电子邮件,那么我应该如何编辑下面的代码以通过代理服务器发送它?
谢谢
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(ConfigurationManager.AppSettings["MailServer"]);
mail.From = new MailAddress(ConfigurationManager.AppSettings["MailAccount"]);
mail.To.Add(toAddres);
mail.CC.Add(new MailAddress(ccAddress));
mail.Subject = subject;
mail.Body = content;
mail.IsBodyHtml = true;
SmtpServer.Port = ConfigurationManager.AppSettings["MailPort"] == null ? 587 : int.Parse(ConfigurationManager.AppSettings["MailPort"]);
SmtpServer.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["MailUserName"], ConfigurationManager.AppSettings["MailPassword"]);
SmtpServer.EnableSsl = false;
SmtpServer.Send(mail);