当前位置: 首页>>代码示例>>C#>>正文


C# Mail.Message类代码示例

本文整理汇总了C#中ActiveUp.Net.Mail.Message的典型用法代码示例。如果您正苦于以下问题:C# Message类的具体用法?C# Message怎么用?C# Message使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Message类属于ActiveUp.Net.Mail命名空间,在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: messagesExplorerListBox_SelectedIndexChanged

        private void messagesExplorerListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.messageRfc822RawTextbox.Text = this.messagesExplorerListBox.SelectedItem.ToString();

            ActiveUp.Net.Mail.Message message = ActiveUp.Net.Mail.Parser.ParseMessage(this.messageRfc822RawTextbox.Text);
            this.messageDetailObjectExplorer.SelectedObject = message;
            _selectedMessage = message;
            this.dataGridView1.DataSource = message.Attachments;
        }
开发者ID:JBTech,项目名称:MailSystem.NET,代码行数:9,代码来源:MainWindow.cs

示例2: PrepareMessageForSerialization

        public void PrepareMessageForSerialization()
        {
            var test_mail = new Message
            {
                From = { Email = "[email protected]", Name = Codec.RFC2047Encode("test") },
                To = { new Address { Email = "[email protected]", Name = Codec.RFC2047Encode("name1") },
                       new Address { Email = "[email protected]", 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);
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:18,代码来源:MessageDeserializationTest.cs

示例3: TestPrepareMessage

        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 = "[email protected]", Name = Codec.RFC2047Encode(text)}
                };

            message.To.Add("[email protected]", 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");
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:24,代码来源:MailBoxManager.Test.cs

示例4: CreateRightResult

        protected void CreateRightResult(Message eml_message, string out_file_path)
        {
            var result = new RightParserResult();
            result.From = new TestAddress();

            result.From.Email = eml_message.From.Email;
            result.From.Name = eml_message.From.Name;

            result.To = new List<TestAddress>();
            foreach (var to_adresses in eml_message.To)
            {
                result.To.Add(new TestAddress {Name = to_adresses.Name, Email = to_adresses.Email});
            }

            result.Cc = new List<TestAddress>();
            foreach (var cc_adresses in eml_message.Cc)
            {
                result.Cc.Add(new TestAddress {Name = cc_adresses.Name, Email = cc_adresses.Email});
            }

            result.Subject = eml_message.Subject;
            result.AttachmentCount = eml_message.Attachments.Count;
            result.UnknownPatsCount = eml_message.UnknownDispositionMimeParts.Count;

            result.HtmlBody = eml_message.BodyHtml.Text;
            result.HtmlCharset = eml_message.BodyHtml.Charset;
            result.HtmlEncoding = eml_message.BodyHtml.ContentTransferEncoding;

            result.TextBody = eml_message.BodyText.Text;
            result.TextCharset = eml_message.BodyText.Charset;
            result.TextEncoding = eml_message.BodyText.ContentTransferEncoding;

            result.ToXml(out_file_path);
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:34,代码来源:MessageParserTestsBase.cs

示例5: ComposeAndSendMailAsync

        internal async Task<string> ComposeAndSendMailAsync(string user,
                                                            string pass,
                                                            string subject,
                                                           string bodyContent,
                                                           string recipients)
        {
            MailSystem.Message message = new MailSystem.Message();
            message.From = new MailSystem.Address(user);
            string[] toEmails = recipients.Split(';');
            foreach (string mailRecepient in toEmails)
            {
                message.To.Add(mailRecepient);
            }
            message.Subject = subject;

            //message.BodyHtml.Text = "This is some html <b>content</b>";
            message.BodyText.Text = bodyContent;
            bool result = ActiveUp.Net.Mail.SmtpClient.SendSsl(message,
               ConfigurationManager.AppSettings["GmailHost"],
               int.Parse(ConfigurationManager.AppSettings["GmailPort"]),
               user,
               pass,
               MailSystem.SaslMechanism.Login);

            if (result) return "1";
            return "-1";
        }
开发者ID:ali-mohamad,项目名称:myWebMailMVC,代码行数:27,代码来源:MailOperations.cs

示例6: Einplanungsemailadressen_sammeln

 internal IEnumerable<string> Einplanungsemailadressen_sammeln(Message msg)
 {
     return msg.To
               .Union(msg.Cc)
               .Union(msg.Bcc)
               .Where(empfänger => empfänger.Email.ToLower().EndsWith("@" + _config["mailserver_domain"]))
               .Select(empfänger => empfänger.Email);
 }
开发者ID:ralfw,项目名称:emailwiedervorlage,代码行数:8,代码来源:ImapAdapter.cs

示例7: HandleRetrievedMessage

 public abstract void HandleRetrievedMessage(MailBox mailbox,
     Message message,
     MailMessageItem message_item,
     int folder_id,
     string uidl,
     string md5_hash,
     bool unread,
     int[] tags_ids);
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:8,代码来源:MessageHandlerBase.cs

示例8: _bSendMessage_Click

        private void _bSendMessage_Click(object sender, EventArgs e)
        {
            this.AddLogEntry("Creating message.");

            // We create the message object

            ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message();

            // We assign the sender email
            message.From.Email = this._tbFromEmail.Text;

            // We assign the recipient email
            message.To.Add(this._tbToEmail.Text);

            // We assign the subject
            message.Subject = this._tbSubject.Text;

            // We add the embedded objets.
            string bodyHtml = string.Empty;    
            for (int i = 0; i < _lvEmbeddedObject.Items.Count; i++)
            {
                message.EmbeddedObjects.Add((string)((Utils.ItemTag)_lvEmbeddedObject.Items[i]).Tag, true);
                bodyHtml += "<img src = \"cid:" + message.EmbeddedObjects[i].ContentId + "\" />";
            }
            message.Send("mail.example.com", 25, "[email protected]", "userpassword", SaslMechanism.CramMd5);

            message.BodyHtml.Format = BodyFormat.Html;
            if (bodyHtml.Length > 0)
            {
                message.BodyHtml.Text = bodyHtml;
            }
            else
            {
                message.BodyHtml.Text = "The message doens't contain embedded objects.";
            }

            // We send the email using the specified SMTP server
            this.AddLogEntry("Sending message.");

            try
            {
                message.Send(this._tbSmtpServer.Text);

                this.AddLogEntry("Message sent successfully.");
            }

            catch (SmtpException ex)
            {
                this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message));
            }

            catch (Exception ex)
            {
                this.AddLogEntry(string.Format("Failed: {0}", ex.Message));
            }

        }
开发者ID:JBTech,项目名称:MailSystem.NET,代码行数:57,代码来源:SendingWithEmbeddedObjects.cs

示例9: buildMessageObject

    	public ActiveUp.Net.Mail.Message buildMessageObject()
    	{
    		_message = new ActiveUp.Net.Mail.Message();
			_message.From = new Address(From_Email,From_Name);
			foreach(var item in To)    		
				_message.To.Add(new Address(item.Key,item.Value)); //syntax: (email, name)
	
			_message.Subject = Subject;
			_message.BodyText.Text = Body.line().line() + Body_SpoofEmailAlertFooter;
			return _message;
    	}
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:11,代码来源:API_ActiveUp_SendEmail.cs

示例10: _bSendMessage_Click

        private void _bSendMessage_Click(object sender, EventArgs e)
        {
            this.AddLogEntry("Creating message.");

            // We create the message object
            ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message();

            // We assign the sender email
            message.From.Email = this._tbFromEmail.Text;

            // We assign the recipient email
            message.To.Add(this._tbToEmail.Text);

            // We assign the return recipient email
            message.ReturnReceipt.Email = this._tbReturnReceipt.Text;

            // We assign the confirmation read email
            message.ConfirmRead.Email = this._tbConfirmReadEmail.Text;

            // We assign the reply to email
            message.ReplyTo.Email = this._tbReplyTo.Text;

            // We assign the comments
            message.Comments = this._tbComments.Text;

            // We assign the mime type.
            message.ContentType.MimeType = "text/html";

            // We assign the subject
            message.Subject = this._tbSubject.Text;

            // We assign the body text
            message.BodyText.Text = this._tbBodyText.Text;

            // We send the email using the specified SMTP server
            this.AddLogEntry("Sending message.");

            try
            {
                message.Send(this._tbSmtpServer.Text);

                this.AddLogEntry("Message sent successfully.");
            }

            catch (SmtpException ex)
            {
                this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message));
            }

            catch (Exception ex)
            {
                this.AddLogEntry(string.Format("Failed: {0}", ex.Message));
            }
        }
开发者ID:JBTech,项目名称:MailSystem.NET,代码行数:54,代码来源:WorkingWithMessageSettings.cs

示例11: GmailSubjectEncodingTest

        public void GmailSubjectEncodingTest()
        {
            Message message = new Message();
            message.From = new Address("[email protected]", "John Doe");
            message.To.Add("[youraccounthere]@gmail.com", "Jean Dupont");
            message.Subject = Codec.RFC2047Encode("Je suis Liégeois et je suis prêt à rencontrer Asger Jørnow", "iso-8859-1");

            message.BodyHtml.Text = "This is some html <b>content</b>";
            message.BodyText.Text = "This is some plain/text content";

            SmtpClient.SendSsl(message, "smtp.gmail.com", 465, "[putyourloginhere]", "[putyourpasshere]", SaslMechanism.Login);
        }
开发者ID:haoasqui,项目名称:MailSystem.NET,代码行数:12,代码来源:SmtpTests.cs

示例12: _bSendMessage_Click

        private void _bSendMessage_Click(object sender, EventArgs e)
        {
            this.AddLogEntry("Creating message.");

            // We create the message object
            ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message();

            // We assign the sender email
            message.From.Email = this._tbFromEmail.Text;

            // We assign the recipient email
            message.To.Add(this._tbToEmail.Text);

            // We assign the subject
            message.Subject = this._tbSubject.Text;

            // We assign the body text
            message.BodyText.Text = this._tbBodyText.Text;

            // It is required to build the mime part tree before signing
            message.BuildMimePartTree();

            if (_tbCertificate.Text != string.Empty)
            {
                CmsSigner signer = new CmsSigner(new X509Certificate2(_tbCertificate.Text));

                // Here we only want the signer's certificate to be sent along. Not the whole chain.
                signer.IncludeOption = X509IncludeOption.EndCertOnly;

                message.SmimeAttachSignatureBy(signer);
            }

            // We send the email using the specified SMTP server
            this.AddLogEntry("Sending message.");

            try
            {
                message.Send(this._tbSmtpServer.Text);

                this.AddLogEntry("Message sent successfully.");
            }

            catch (SmtpException ex)
            {
                this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message));
            }

            catch (Exception ex)
            {
                this.AddLogEntry(string.Format("Failed: {0}", ex.Message));
            }
        }
开发者ID:haoasqui,项目名称:MailSystem.NET,代码行数:52,代码来源:SendingSignedEmails.cs

示例13: sendTestMessageButton_Click

        private void sendTestMessageButton_Click(object sender, EventArgs e)
        {
            this.AddLogEntry("Sending test message using DirectSend()");

            ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message();
            message.From.Email = this.emailAddressTextbox.Text;
            message.To.Add(this.emailAddressTextbox.Text);
            message.Subject = "This is a notification test.";
            message.BodyText.Text = "This is a notification test.";
            message.DirectSend();

            this.AddLogEntry("Notification test message sent.");
        }
开发者ID:JBTech,项目名称:MailSystem.NET,代码行数:13,代码来源:NewMessageNotification.cs

示例14: _bSendMessage_Click

        private void _bSendMessage_Click(object sender, EventArgs e)
        {
			if (this._lvAttachments.Items.Count > 0)
			{
				this.AddLogEntry("Creating message.");

				// We create the message object
				ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message();

				// We assign the sender email
				message.From.Email = this._tbFromEmail.Text;

				// We assign the recipient email
				message.To.Add(this._tbToEmail.Text);

				// We assign the subject
				message.Subject = this._tbSubject.Text;

				// We assign the body text
				message.BodyText.Text = this._tbBodyText.Text;

				// We now add each attachments
				foreach (string attachmentPath in this._lvAttachments.Items)
				{
					message.Attachments.Add(attachmentPath, false);
				}

				// We send the email using the specified SMTP server
				this.AddLogEntry("Sending message.");

				try
				{
					message.Send(this._tbSmtpServer.Text);

					this.AddLogEntry("Message sent successfully.");
				}
				catch (SmtpException ex)
				{
					this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message));
				}
				catch (Exception ex)
				{
					this.AddLogEntry(string.Format("Failed: {0}", ex.Message));
				}
			}

			else
			{
				MessageBox.Show("Please add an attachment before sending this test message.");
			}
        }
开发者ID:JBTech,项目名称:MailSystem.NET,代码行数:51,代码来源:SendingWithFileAttachments.cs

示例15: useSelectedButton_Click

        private void useSelectedButton_Click(object sender, EventArgs e)
        {
            ActiveUp.Net.Mail.Pop3Client client = new ActiveUp.Net.Mail.Pop3Client();
            client.Connect(this.pop3ServerHostTextbox.Text, Convert.ToInt32(this.pop3ServerPortNumericUpDown.Value),
                this.pop3ServerUsernameTextbox.Text, this.pop3ServerPasswordTextbox.Text);

            Header gridSelection = (Header)this.dataGridView1.SelectedRows[0].DataBoundItem;

            _selectedMessage = client.RetrieveMessageObject(gridSelection.IndexOnServer);

            client.Close();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
开发者ID:JBTech,项目名称:MailSystem.NET,代码行数:14,代码来源:Pop3Client.cs


注:本文中的ActiveUp.Net.Mail.Message类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。