コード例 #1
1
        public void PrepareMessageForSerialization()
        {
            var test_mail = new Message
            {
                From = { Email = "*****@*****.**", Name = Codec.RFC2047Encode("test") },
                To = { new Address { Email = "*****@*****.**", Name = Codec.RFC2047Encode("name1") },
                       new Address { Email = "*****@*****.**", Name = Codec.RFC2047Encode("name2") } },
                Subject = Codec.RFC2047Encode("test"),
                BodyText = { Charset = utf8_charset,
                            ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable,
                            Text = "test" },
                BodyHtml = { Charset = utf8_charset,
                             ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable,
                             Text = "<a href='www.teamlab.com'>test</a>" }
            };

            test_mail.StoreToFile(TestFilePath);
        }
コード例 #2
1
        public static void TestPrepareMessage()
        {
            var charset = Encoding.UTF8.HeaderName;
            const string text = "тест";
            const string html = "<a href='www.teamlab.com'>" + text + "</a>";

            var message = new Message
                {
                    From = {Email = "*****@*****.**", Name = Codec.RFC2047Encode(text)}
                };

            message.To.Add("*****@*****.**", Codec.RFC2047Encode(text));

            message.Subject = Codec.RFC2047Encode(text);

            message.BodyText.Charset = charset;
            message.BodyText.ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable;
            message.BodyText.Text = text;
            message.BodyHtml.Charset = charset;
            message.BodyHtml.ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable;
            message.BodyHtml.Text = html;

            message.StoreToFile(@"test_send_prepared.eml");
        }
コード例 #3
0
ファイル: MailSenderForm.cs プロジェクト: isaachogue/Archived
        /// <summary>
        /// Save event handler.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        private void toolStripButtonSave_Click(object sender, EventArgs e)
        {
            string currentDir = Directory.GetCurrentDirectory();
            SaveFileDialog saveDialog = new SaveFileDialog();
            saveDialog.Filter = "ActiveUp Email Files |*.eml";
            DialogResult dr = saveDialog.ShowDialog();
            if (dr == DialogResult.OK)
            {
                ActiveUp.Net.Mail.Message message = this.CreateMessage();
                message.StoreToFile(saveDialog.FileName);
            }

            Directory.SetCurrentDirectory(currentDir);
        }
コード例 #4
-1
    private void saveSentMail(Message message)
    {
        try
        {

            string path = Path.Combine(Path.GetTempPath(), Constants.SENT_MAILS_FOLDER);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            message.StoreToFile(Path.Combine(path, Guid.NewGuid().ToString()));
        }
        catch (Exception)
        {
            Session["ErrorMessage"] = "The message could not save into SentMail";
            Response.Redirect("~/ErrorPage.aspx");
        }
    }