public static void Main(string[] args) { RssSmtpSection conf = (RssSmtpSection)ConfigurationManager.GetSection("rssSmtpGroup/rssSmtp"); int interval = 10 * 1000; _transmitter = new Rss2Smtp(conf); Timer rssTimer = new Timer(); rssTimer.Elapsed += new ElapsedEventHandler(UpdateEvent); rssTimer.Interval = interval; rssTimer.Start(); string command = ""; Console.Write(">_"); while (!(command = Console.ReadLine()).Equals("exit")) { if (command.Equals("update")) { _transmitter.Update(); } Console.Write(">_"); } rssTimer.Stop(); }
public Rss2Smtp(RssSmtpSection config) { _mail.From = new MailAddress(config.From); _mail.To.Add(config.To); _mail.Subject = config.Subject; _smtpServer.Host = config.Host; _smtpServer.Port = config.Port; _smtpServer.Credentials = new System.Net.NetworkCredential(config.User, config.Pass); _smtpServer.EnableSsl = config.EnableSsl; ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }; _rssPath = config.Rss; }
public Rss2Smtp(RssSmtpSection config) { _mail.From = new MailAddress(config.From); _mail.To.Add(config.To); _mail.Subject = config.Subject; _smtpServer.Host = config.Host; _smtpServer.Port = config.Port; _smtpServer.Credentials = new System.Net.NetworkCredential(config.User, config.Pass); _smtpServer.EnableSsl = config.EnableSsl; ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; _rssPath = config.Rss; }