PowerTCP Mail for .NET
MessageStream Class
Members  Example  See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace : MessageStream Class




Represents an email message.

Object Model

MessageStream ClassAttachments ClassAttachmentStream ClassMailAddresses ClassMailAddress ClassMailAddresses ClassMailAddress ClassMailAddress ClassMailHeader ClassString ClassNonMime ClassParts ClassStream ClassMailAddress ClassMailAddress ClassMailAddresses ClassMailAddress Class

Syntax

Visual Basic (Declaration) 
<LicenseProviderAttribute(MessageStreamLicenseProvider)>
Public Class MessageStream 
   Inherits System.IO.Stream
Visual Basic (Usage)Copy Code
Dim instance As MessageStream
C# 
[LicenseProviderAttribute(MessageStreamLicenseProvider)]
public class MessageStream : System.IO.Stream 
Managed Extensions for C++ 
[LicenseProviderAttribute(MessageStreamLicenseProvider)]
public __gc class MessageStream : public System.IO.Stream 
C++/CLI 
[LicenseProviderAttribute(MessageStreamLicenseProvider)]
public ref class MessageStream : public System.IO.Stream 

Example

The following example demonstrates creating a basic MIME message with a single attachment.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

' Create a MessageStream object
Dim msg As New MessageStream()

' Add a normal recipient
msg.To.Add(New MailAddress("you@test.com"))

' Add a CC recipient
msg.CC.Add(New MailAddress("you2@test.com"))

' Add a BCC recipient
msg.BCC.Add(New MailAddress("you3@test.com"))

' Specify the sender
msg.From = New MailAddress("me@test.com")

' Specify the subject
msg.Subject = "Hello"

' Add some text to the message.
msg.Text = "Hi everyone. How are ya doing?"

' Add an attachment
msg.Attachments.Add("C:\files\graph.jpg")

' Specify the server
Smtp1.Server = "mail.test.com"

' Send the message
Smtp1.Send(msg)
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// Create a MessageStream object
MessageStream msg = new MessageStream();

// Add a normal recipient
msg.To.Add(new MailAddress("you@test.com"));

// Add a CC recipient
msg.CC.Add(new MailAddress("you2@test.com"));

// Add a BCC recipient
msg.BCC.Add(new MailAddress("you3@test.com"));

// Specify the sender
msg.From = new MailAddress("me@test.com");

// Specify the subject
msg.Subject = "Hello";

// Add some text to the message.
msg.Text = "Hi everyone. How are ya doing?";

// Add an attachment
msg.Attachments.Add("C:\\files\\graph.jpg");

// Specify the server
smtp1.Server = "mail.test.com";

// Send the message
smtp1.Send(msg);

Remarks

The MessageStream object represents an Internet email message. Most mail operations with PowerTCP Secure Mail for .NET (both sending and receiving) will require use of the MessageStream object. Many properties of the MessageStream object are collections, enabling easy management of message entities. The following list contains collections useful when sending or receiving mail:

  • MessageStream.NonMime contains all non-MIME parts.
  • MessageStream.NonMime.Text contains the non-MIME text of the message.
  • MessageStream.NonMime.Attachments contains the non-MIME attachments for the message.
  • MessageStream.Parts contains all MIME parts.
  • MessageStream.Parts.Simple contains all simple, inline MIME parts (such as MIME text).
  • MessageStream.Parts.Attachments contains all MIME attachments.
  • MessageStream.Parts.Complex contains all complex (multipart) MIME parts.
  • MessageStream.To contains all normal recipients.
  • MessageStream.CC contains all carbon-copy recipients.
  • MessageStream.BCC contains all blind carbon-copy recipients.
  • MessageStream.Header contains the header for the message.
  • MessageStream.Attachments contains all the recursive attachments for the entire message (including MessageStream.NonMime.Attachments, MessageStream.Parts.Attachments, and recursive MessageStream.Parts.Complex attachments.

When using the MessageStream object, message parts are always encoded/decoded "on the fly", which both increases the speed of processing and eliminates use of temp files in encoding/decoding.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.IO.Stream
         Dart.PowerTCP.Mail.MessageStream

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.