Esempio n. 1
0
        protected override void AfterWriteAction(string file)
        {
            base.AfterWriteAction(file);

            var         cfg  = GlobalSettings.Pages.Email();
            MailMessage mail = new MailMessage();

            mail.From = cfg.GetFromAddress();
            foreach (string addr in To.Split(';'))
            {
                mail.To.Add(addr);
            }
            mail.Subject    = NameTemplateEngine.Eval(Subject);
            mail.Body       = Body;
            mail.IsBodyHtml = false;
            using (var fr = new FileInfo(file).OpenRead())
            {
                var att = new Attachment(fr, Path.ChangeExtension(AttachmentName, Path.GetExtension(file)));
                mail.Attachments.Add(att);

                SmtpClient smtp = cfg.GetClient();
                ProgressInfo.Info("Sending mail to " + To);
                smtp.Send(mail);
            }
        }
Esempio n. 2
0
        private FtpWebRequest CreateRequest()
        {
            var req = (FtpWebRequest)FtpWebRequest.Create("ftp://" + Server + "/" + NameTemplateEngine.Eval(Path));

            req.Credentials = new NetworkCredential(Login, Password);
            req.KeepAlive   = false;
            req.UsePassive  = PassiveMode;
            return(req);
        }
Esempio n. 3
0
 public override string GetWorkingFileName()
 {
     m_lastWorkingFile = Path.Combine(Folder, NameTemplateEngine.Eval(FileTemplate));
     return(m_lastWorkingFile);
 }
Esempio n. 4
0
 private void RefreshSample()
 {
     tbxSample.Text = NameTemplateEngine.Eval(tbxTemplate.Text);
 }