1

Hi I want to send mail with ASP.NET, but I want to send email through proxy server, So how should I edit the code below to send it through a proxy server?

Thanks

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);
Kapil Khandelwal
  • 15,958
  • 2
  • 45
  • 52
  • Ok it is done, any suggestion? – kubilay bayraktar Nov 08 '12 at 06:44
  • 1
    Please refer to [this question and relative accepted answer](http://stackoverflow.com/questions/3156753/is-there-net-library-for-email-sending-via-proxy). It explains the SMTP via proxy misunderstanding. – Steve Nov 08 '12 at 08:12

0 Answers0