示例#1
0
 /// <summary>
 /// Deprecated. Creates an attachment using plain text, without any compression.
 /// </summary>
 /// <param name="sa"></param>
 /// <returns></returns>
 private Attachment GetStringAttachment(SendArg sa)
 {
     String attachment = GetAttachment(sa);
     MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(attachment));
     Attachment att = new Attachment(ms, sa.FileName);
     att.NameEncoding = Encoding.Default;
     return att;
 }
示例#2
0
        private String GetAttachment(SendArg sa)
        {
            String file = sa.Content;
            // check extension
            String ext = Path.GetExtension(sa.FileName).ToLower();
            if (ext == ".htm" || ext == ".html")
            {
                // modyfy the header of the file
                file = Regex.Replace(file, "<html[^>]*>.*<body[^>]*>", "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
            }

            return file;
        }
示例#3
0
        private void SendFile()
        {
            SendArg arg = new SendArg(fileName, content, tbAccount.Text, tbEmail.Text,
                tbSMTP.Text, Int16.Parse(tbPort.Text), tbUser.Text, tbPassword.Text);

            SendForm frm = new SendForm(arg);
            frm.ShowDialog();
        }
示例#4
0
 private Attachment MakeAttachment(SendArg sa)
 {
     String attachment = GetAttachment(sa);
     Stream s = ZipHelper.MakeZipStream(attachment, sa.FileName);
     return new Attachment(s, "attachment.zip", System.Net.Mime.MediaTypeNames.Application.Zip);
 }
示例#5
0
 public SendForm(SendArg arg)
     : this()
 {
     this.arg = arg;
 }