PowerTCP Mail for .NET
Send comments on this topic

Glossary Item Box

Welcome!

Welcome and thank you for choosing PowerTCP Mail for .NET. You have selected what we feel is the most sophisticated and complete .NET Mail development toolkit available. We know you have a choice in software vendors and we will do our best to exceed your expectations.

Overview

Mail for .NET provides email sending and retrieving capabilities beyond what is provided by the .NET Framework. Mail for .NET can be plugged into any Framework 2.0, 3.0. 3.5, 4.0 or 4.5 application. The extended functionality includes:

  • Components for SMTP, POP3 and IMAP4
  • Comprehensive explicit and implicit encryption (SSL)
  • S/MIME encryption/decryption and signing
  • "On-the-fly" encoding/decoding reduces memory/disk footprint
  • Stream interface provides direct access to data
  • Full support for International character sets
  • Progress event for real-time transfer notification
  • Log event for session logging and debugging
  • Comprehensive authentication techniques supported, including NTLM and GSS/API
  • Extensive firewall and proxy support
  • Access to the underlying TCP connection for low-level control
  • Support for sending custom commands
  • Hierarchical access to all parts of a mail message
  • A Start method for multi-threaded applications
  • Marshal methods for cross-threading marshaling support

About Us

Quality!

Dart Communications, located in upstate New York, has been designing and developing Internet communication components since 1994. More than a decade later, PowerTCP, PowerSNMP and PowerWEB for ASP.NET are International bestsellers to small businesses, consultants, and Fortune 500 companies.

Each targeted protocol is extensively researched by Dart and each product is tested and supported by consistent processes and customer feedback. Developers using our products can focus on creating the unique features they require rather than wasting weeks on research and unnecessary code writing.

Added Value

Dart Communications is committed to creating products that are of high quality, flexible, and easily implemented into a project. This process means maintaining meticulous documentation and a readily available support staff. In addition, Dart consistently processes feedback and requests, using this information for new product and feature development.

Dart's development team is also available for custom development projects relating to their product line. A customer may lack the time or background to complete a particular project as needed. Dart's team will draw on their protocol knowledge and experience to supply a quality solution within the time frame required.

Expertise

Building components is about reliability. Developers need products that can stand up to use, that work as intended, and that go beyond original expectations. Our research tells us that users often change the scope of a project once it is underway. PowerTCP products are designed to scale to those increased expectations. To give you time to evaluate this claim prior to purchase, Dart supplies a fully functional trial for all of its products. See for yourself how a component can have both high-level functionality for quick and easy solutions, and also provide a low-level interface for customization.

In today's world, software developers are routinely asked to produce solutions using unfamiliar technologies, with little time allowed for research. When Internet Communications is part of your project, consider leveraging Dart's proven components to connect, encode, compress, encrypt and transfer data. Our goal is to help you build applications that work the first time, every time.

Documentation Version 4.3
© 2016 Dart Communications. All Rights Reserved.


Getting Started

Getting Started
Send comments on this topic

Glossary Item Box

We recommend the user read this documentation and examine the included sample applications to become familiar with the Mail for .NET classes. For the most basic quick-start, create a new Windows Application project in Visual Studio, and see the Code Examples page for accessible examples to try.

PowerTCP Mail for .NET is a complete suite of classes that integrate SMTP, POP, IMAP and RFC 2822 mail message construction into any .NET application. This topic, and related subtopics, address issues such as licensing, distribution, and support for PowerTCP Mail for .NET. For code examples and a programmer's reference of the classes used by the PowerTCP Mail for .NET, see the Assembly Overview section.

Show Sample Applications

Sample | Description
SMTP Client | Create and send Internet email using the MailMessage class and the Smtp component.
SMTP Web Client | Create and send email from an ASP.NET application.
POP Client | Get message headers or complete messages from a mail account. Reply to messages or Forward and Redirect them to other recipients. Delete messages from the account.
POP Web Client | Get messages from an ASP.NET application.
IMAP Client | Download messages, create and manage remote mailboxes, upload messages and set message flags.
IMAP Web Client | Get messages and manage remote mailboxes from an ASP.NET application.
IMAP Part Retriever | Retrieve specific parts of messages (for example, only attachments) from the server.
Message Editor | Load and display a message for editing. View its various parts (including headers, attachments, and nested parts). Modify the message and save it.
SMTP Web Service | Create and send email from a web service application.
SMTP WCF Service | Create and send email from a WCF service.
SMTP WPF Client | A WPF version of the SMTP Client sample.

Show Support Options

Our mission is to deliver high quality Internet connectivity solutions to Internet application developers. Our goal is to supplement these solutions with timely support resources that can help at many different levels.

You must have an active connection to the Internet to view these links.

Paid Support Options
Describes the paid support options available.
Free Support Options
Provides access to free materials to help your development, including FAQS, online help files, tutorials, code snippets, online asp samples, and a free support forum.
Support Forum
Provides access to questions and answers provided to other customers; monitored by our own development staff as time permits.
Dart Solutions
Describes available custom development support.

Show Authenticode Signing

Dart installation executables are authenticode signed with a "Dart Communications" digital certificate to ensure against tampering during distribution.

Dart dlls included in the installation bin directory are .NET strong name signed, but not authenticode signed. These dlls are used by the sample applications and typically referenced in users' products.

For those users who require dlls signed by the author company (for example, for Windows logo compliance), dlls that have been signed with the "Dart Communications" digital certificate are also included in the product. These dlls are contained in the "Signed Distributables" sub-folder under the installation bin folder.

In accordance with the End-User Licensing Agreement, pre-compiled Dart dlls may NOT be signed with a user's own certificate. However, for users who wish to independently sign these dlls, Dart offers an ISV license which allow for this. Please contact sales@dart.com for more information.

Show Requirements

Target Platforms: Microsoft .NET Framework 2.0 SP1 and higher.


Licensing and Trial Operation

Licensing and Trial Operation
Send comments on this topic

Glossary Item Box

Show Application Licensing

The licenses.licx File

All Dart classes require a licenses.licx file in the executing assembly’s project, containing an entry for each licensed class. Without the licenses.licx, a runtime license will not be generated and compiled into the assembly, and a license exception will be thrown at runtime.

When a licensed control or component is added to a project using the Visual Studio designer, a licenses.licx file will be automatically generated if one does not already exist, and an entry for the class added.

When developing an assembly with no design surface such as a console application, or when instantiating a licensed class in code, the licenses.licx file must be added manually. If a licenses.licx file is not present in the project, add a new text file named "licenses.licx" to the project (not the solution) from the Solution Explorer. Add a single line to the licenses.licx that includes the fully-specified class name and the assembly name, separated by a comma. For example:

Dart.Mail.Smtp, Dart.Mail

Web Site Projects

Web Site projects include an App_Licenses.dll that must be rebuilt when changes are made to the licenses.licx file or when migrating from trial to licensed operation. The App_Licenses.dll can be rebuilt by right-clicking on the licenses.licx file in the Solution Explorer and selecting the "Rebuild Runtime Licenses" option.

Powershell and other Scripting Environments

Because PowerShell does not execute compiled code and its scripts are generally modifiable by end users, a development or trial license is required on any machine executing scripts. If an environment other than PowerShell is being used or another distribution method is desired, please contact support@dart.com for additional options.

Other Development Environments

For compilation environments that do not recognize the licenses.licx file, a license resource may be generated with the .NET or MONO lc.exe utility on a licensed machine and added to the project as an embedded resource, or linked during compilation using the appropriate resource switch. For specific instructions, check with the environment's manufacturer.

Show Development Platform Licensing

Trial Operation

Dart components include a 30-day introductory trial period. With the exception of trial messages and trial runtime license expiration exceptions, runtime trial operation is the same as licensed operation.

A 7-day runtime license will be embedded in assemblies compiled during the trial period. After 7 days, Dart classes will throw an exception and the assembly will no longer function. The 7-day runtime license can be reset within the 30-day trial period by recompiling the project.

Compiling assemblies with a trial license is supported under compilation environments with a UI (such as Visual Studio), but not those without one (such as a build service or build server); a Developer License is required to build assemblies under such environments.

A trial installation can be licensed by purchasing and activating a Product Key.

Licensed Operation

A Developer License is required to compile licensed assemblies. A valid Product Key is required to generate a Developer License. Each Developer License is machine and version specific; major and minor version increments (for example, 4.0, 4.1 and 5.0) require separate Product Keys and Developer Licenses, build and revision do not.

Product and license upgrades are available through the Customer Center to developers with an active subscription.

Obtaining a Developer License

Run the included license activation utility from the Activate PowerTCP Mail for .NET 4.3 shortcut in the product's Start Menu program group. The utility will guide you through the registration and activation process. Once complete, the Developer License file will be emailed to you. Copy the dartlic file attached to the email to the following location:

Program Files (x86) \ Dart \ PowerTCP Mail for .NET \ 4.3 \ bin

This location is also accessible from the 'Binaries Folder' shortcut in the product's Start Menu program group.

Note: On UAC-enabled operating systems, the dartlic file may need to be saved to a non-UAC-protected location before copying it to the aforementioned location.

If Internet access is not available on the development machine, the activation utility provides a URL for activating the license on a machine with Internet access so that the Developer License can be retrieved and copied to the development machine.

Note: All licensing messages and exceptions are logged to the Application Event Log with "Dart Components" as the event source. If the "Dart Components" event source could not be created, messages are logged under the ".NET Components" event source. The Application Event Log can be examined for licensing messages and exceptions in situations where message boxes cannot be displayed or no GUI is present.

Show Deployment

Dart components support xcopy deployment and do not require any files other than the component dll and compiled project assemblies.


Code Examples

Code Examples
Send comments on this topic

Glossary Item Box

The following lists direct links to pages in this help file that contain easy-to-follow code examples.

General Examples

OAuth usage

Use Start and Marshal to execute functions without blocking the User Interface

Save attachments to disk

Save resources (HTML inline files) to disk

Save messages to disk

IMAP Examples

Connect to an IMAP server and authenticate, with encryption options

Retrieve all messages in a mailbox

Get only the headers of the messages in a mailbox

Display progress while retrieving messages

Create, rename and delete a mailbox

Subscribe a mailbox

Search for and only retrieve messages that fit a specific criteria

Upload a message to a mailbox

Copy messages in one mailbox to another

Using IMAP IDLE

Delete a single message

Delete a set or range of messages

Download a message's attachments without downloading the entire message

SMTP and MailMessage Examples

Connect to an SMTP server and authenticate, with encryption options

Create and send a mail message

Send a message on a worker thread, without blocking the User Interface

Add an attachment to a message

Reply to a message

Create a reply separator for a UI-based reply

Forward a message

Redirect a message

Create a custom Reply message

Create an HTML message

Add custom header lines to a message

Create an S/MIME signed message

Create an S/MIME encrypted message

Decode S/MIME messages

Using DSN

POP Examples

Connect to a POP server and authenticate, with encryption options

Retrieve all messages from the server

Get only the headers of the messages on the server

Save retrieved messages to disk

Display progress while retrieving messages

Log a session to a textbox


Designed for Modern Applications

Designed for Modern Applications
Send comments on this topic

Glossary Item Box

PowerTCP Mail for .NET exposes a modern multi-threaded design with technical advantages over competing products.

Async Methods

The async methods (BeginXXX) seen in competing products reflect an antiquated single-threaded design model that denies the benefits of multiple .NET worker threads. Please read on to see how PowerTCP Mail for .NET delivers native multi-threaded power to your application without adding the complexity that is often associated with multi-threading techniques.

Operation on the client side of the Internet mail client/server model is inherently command driven, so Mail for .NET provides a simple Start(delegate) method that executes the delegate function on a worker thread. This straight-forward concept provides a flexible technique for using PowerTCP in any application environment.

This design eliminates the need for BeginXXX methods and EndXXX events. There is a clean interface with one method for each function and several advantages are immediately realized:

Efficiency. Methods are designed to efficiently block on socket receive operations (the thread sleeps until bytes are received). This results in the most robust and efficient design possible.

Reusable code. Your delegate(s) can be used in applications both with and without a UI. It is no longer necessary to use BeginFoo for Windows Forms applications, and (the blocking) Foo for services, web applications and console applications.

Lower life-cycle cost. Code is written sequentially because there is no UI message pump to consider. It is not necessary to write code for numerous event handlers. Your code is self-documenting, easier to debug and maintain, and has a lower life-cycle cost.

Easy-to-implement parallel operation. Worker threads are easily spawned, supporting intensively parallel operations. Alternatively, serial operation is easily implemented by using a single thread. Flexibility of design is key.

No more state machine. It is not necessary to track state in event handlers. Take the simple case where the following sequence takes place:

  • Receive data R1
  • Send data S1
  • Receive data R2
  • Send data S2

Using BeginXXX, an event is raised when data is received and a state machine is required (if R1 is received then send S1, else if R2 is received then send S2). Using a single worker thread, the operation is coded in simple, declarative steps (Receive R1, Send S1, Receive R2, Send S2).

No More Pseudo-Blocking

Competing products use "pseudo-blocking" to process UI events while the method blocks. Without pseudo-blocking overhead methods are faster and more efficient. Also, re-entrancy problems (caused when UI messages are processes while a communication method is in progress) are no longer possible.

Developing Applications Without a UI

Developing console applications, web applications, services and other applications without a UI is as easy as ever. Sequential code performs efficiently. If parallel operation is desired, Start(delegate) can be used to execute code in any delegate body in parallel.

Developing Applications With a UI

Developing Windows Forms applications is now just as easy as writing applications without a UI. One method (the delegate) can be used in both types of applications. The only difference is that a UI app uses Start(delegate) to spawn a worker thread upon which the method executes, and any data needed by the UI must be marshaled to the UI thread. To this end, PowerTCP components include Start() and Marshal() convenience methods.

The Start Method

Use the Start method to execute one or more methods on a new worker thread, so the UI is not blocked during operation. The syntax for this method is simple:

C# Copy Code
smtp1.Start(myBlockingFunction, myObject);

private void myBlockingFunction(object myObject)
{
   ...
}

Visual Basic Copy Code
smtp1.Start(AddressOf myBlockingFunction, myObject)

Private Sub myBlockingFunction(ByVal myObject As Object)
   ...
End Sub

The state parameter for Start (myObject in this snippet) may be any object, including object arrays, allowing any number of discrete objects to be passed into the worker thread, which can then be cast back to their original types on the worker thread.

Marshaling Data

It is often necessary to pass information from a worker thread to update an element on the UI thread. Use the Marshal method for this purpose. Each Marshal overload is paired with an event that is raised on the UI thread. For example:

C# Copy Code
smtp1.Marshal("Message from the worker thread!", null); //Execute on worker thread

private void smtp1_UserState(object sender, UserStateEventArgs e)
{
   //A message and/or an object was marshaled to the UI from a worker thread
   MessageBox.Show(e.Message);
}

Visual Basic Copy Code
smtp1.Marshal("Message from the worker thread!", Nothing) 'Execute on worker thread

Private Sub smtp1_UserState(ByVal sender As Object, ByVal e As UserStateEventArgs) Handles smtp1.UserState
   'A message and/or an object was marshaled to the UI from a worker thread
   MessageBox.Show(e.Message)
End Sub

Just like Start, the state parameter for Marshal may be used to pass any object, including object arrays, over to the UI thread, which may then be cast back to their original type on the UI thread.

Typical Use

The developer wants to execute a series of functions without interfering with the user-interface. A button, textbox, and the PowerTCP Smtp component are added to the form. Pressing the button will initiate a session which creates and sends a mail message. A log of the session is displayed in the textbox. The sendMail function, which can be reused in a non-UI application, is passed to Start and executes on a worker thread.

C# Copy Code
private void button1_Click(object sender, EventArgs e)
{
    //Send a message to the specified recipient
    //The Start method is used to execute the operation on a worker thread
    //(Event handlers were added in the designer)
    smtp1.Start(sendMail, "myRecipient@dart.com");
}

private void sendMail(object state)
{
    //This function executes on a worker thread without blocking the UI
    //Create message to send
    MailMessage message = new MailMessage();
    message.To = state as string;
    message.From = "sender@dart.com";
    message.Subject = "Here is your file";
    message.Text = "Please see the attached file.";
    message.Attachments.Add(new Attachment("myAttachment.doc"));

    //Set session parameters
    smtp1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint("myMailServer", Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = "myUsername";
    smtp1.Session.Password = "myPassword";

    //Send message and logout
    smtp1.Send(message);
    smtp1.Close();
}

private void smtp1_Connection_Log(object sender, DataEventArgs e)
{
    //Log the communication to a textbox
    textBox1.AppendText(e.Data.ToString());
}

private void smtp1_Error(object sender, ErrorEventArgs e)
{
    //Any unhandled exception on the worker thread will be automatically marshaled here.
    MessageBox.Show(e.GetException().Message, "Error during send");
}
Visual Basic Copy Code
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    'Send a message to the specified recipient
    'The Start method is used to execute the operation on a worker thread
    '(Event handlers were added in the designer)
    smtp1.Start(AddressOf sendMail, "myRecipient@dart.com")
End Sub

Private Sub sendMail(ByVal state As Object)
    'This function executes on a worker thread without blocking the UI
    'Create message to send
    Dim message As New MailMessage()
    message.To = TryCast(state, String)
    message.From = "sender@dart.com"
    message.Subject = "Here is your file"
    message.Text = "Please see the attached file."
    message.Attachments.Add(New Attachment("myAttachment.doc"))

    'Set session parameters
    smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint("myMailServer", Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = "myUsername"
    smtp1.Session.Password = "myPassword"

    'Send message and logout
    smtp1.Send(message)
    smtp1.Close()
End Sub

Private Sub smtp1_Connection_Log(ByVal sender As Object, ByVal e As DataEventArgs)
    'Log the communication to a textbox
    textBox1.AppendText(e.Data.ToString())
End Sub

Private Sub smtp1_Error(ByVal sender As Object, ByVal e As ErrorEventArgs)
    'Any unhandled exception on the worker thread will be automatically marshaled here.
    MessageBox.Show(e.GetException().Message, "Error during send")
End Sub


MVC Design in Applications

MVC Design in Applications
Send comments on this topic

Glossary Item Box

Extending the Model-View-Controller Design Philosophy to Applications

One feature of the new version 4 components is the ease with which applications can be developed using a Model-View-Controller (MVC) design. MVC is a design philosophy that isolates application business logic from the user interface. The following white paper offers a detailed discussion of this design and its application to the PowerTCP and PowerSNMP components:

http://www.dart.com/articles_mvc.aspx

MVC design has been incorporated into some of the more sophisticated PowerTCP and PowerSNMP sample applications, providing two key benefits:

Separation of protocol logic from the user interface

Encapsulating protocol logic in a class separates it from any user interface, providing clean code that can be reused in other projects, with other interfaces.

The Smtp, Pop and Imap Client samples provide a nice demonstration of this separation. These samples implement a model class where all code pertaining to communication logic - logging in, sending and retrieving email, manipulating messages on the server - resides. The protocol functionality can easily be extended or modified without affecting the UI. These model classes can easily be reused in other applications, with other interfaces. In addition, encapsulating the data and logic pertaining only to protocol functions provides a cleaner project that is easier to digest and maintain.

Simplified storage of runtime state information

Saving runtime state information and persisting this information when the application is terminated is a key feature of many applications. Model classes can facilitate this.

Again, the Smtp, Pop and Imap Client samples are typical examples.

First, each sample's model class provides properties for storing runtime data, including session data and security settings. This class provides a "ground truth" for the state of the application, instead of the interface itself holding this information. The interface provides a means for updating the model, but is itself "dumb." Also, the encapsulated data can be easily passed to objects such as Settings and Connection forms, which are implemented as interfaces for updating the information contained within the model.

Second, as a serializable class, the model provides a means for easily persisting settings when the application is terminated. In the past, PowerTCP and PowerSNMP samples dedicated large chunks of code for saving and loading application settings, usually in the registry. PowerTCP 4 components have taken a different approach, focusing instead on providing help for serialization. This includes helper functions for Serializing and Deserializing objects to and from streams, as well as providing state information in serializable objects that can be easily stored. For example, the SmtpModel class stores an SmtpSession object which includes RemoteEndPoint, Username, Password, Security information and much more.

The sample applications are available as an option during the product installation, and can also be downloaded by clicking on the "Download Samples" link in the Start Menu.


PowerTCP and Asynchronous Programming with Async and Await

PowerTCP and Asynchronous Programming with Async and Await
Send comments on this topic

Glossary Item Box

The Tasks class and the async and await keywords were introduced in .NET 4.5, providing a simpler structure for creating multi-threaded applications compared to the thread-based or single-threaded apartment models of the past. Its primary benefit is the ability to code multi-threaded/asynchronous applications with a straightforward logical structure that resembles synchronous code. Further features include passing parameters directly into the asynchronous function, directly returning return values, and catching exceptions directly around the asynchronous call. For our components, this also obsoletes the need for the Start and Marshal methods, along with the UserState and Error event (among others specific to each component).

Task.Run() may be used to execute the code specified in its lambda statement on a separate thread. Used by itself, the call immediately returns (while the lambda statement executes on its new thread), and continues on to the next line of code. When used in conjunction with await (and marking the containing method or event with the 'async' keyword), the next line of code will only be called once Task.Run returns (and, using await allows the method to return a value). While the awaited method executes on its thread, execution of the UI thread is returned to the caller of the method marked with the async keyword.

The multithreaded implementation of our 4.x components is compatible with these Tasks, and there is little difference between the use of the two; calls to PowerTCP components within Tasks are equal to calling them within a thread created with Start(). Where Start() and the UserState event were used previously:

C# Copy Code
private void button1_Click(object sender, EventArgs e)
{
    myComponent.Start(myBlockingFunction, null);
}

private void myBlockingFunction(object myObject)
{
    //This executes on a worker thread, so it could contain
    //any long-running code, and still not block the UI
    myComponent.Marshal("Message from the worker thread", null);
}

void myComponent_UserState(object sender, UserStateEventArgs e)
{
    MessageBox.Show(e.Message);
}
Visual Basic Copy Code
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    myComponent.Start(AddressOf myBlockingFunction, Nothing)
End Sub

Private Sub myBlockingFunction(ByVal myObject As Object)
    'This executes on a worker thread, so it could contain
    'any long-running code, and still not block the UI
    myComponent.Marshal("Message from the worker thread", Nothing)
End Sub

Private Sub myComponent_UserState(ByVal sender As Object, ByVal e As UserStateEventArgs)
    MessageBox.Show(e.Message)
End Sub

You can now use:

C# Copy Code
private async void button1_Click(object sender, EventArgs e)
{
    //This call will not block the UI thread
    string taskText = await myBlockingFunctionAsync();
    MessageBox.Show(taskText);
}

private Task<string> myBlockingFunctionAsync()
{
    //This Task.Run lambda statement could contain any long-running code, and still not block the UI
    return Task.Run<string>(() =>
    {
        return "Message from Task";
    });
}
Visual Basic Copy Code
Private Async Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    'This call will not block the UI thread
    Dim taskText As String = Await myBlockingFunctionAsync()
    MessageBox.Show(taskText)
End Sub

Private Function myBlockingFunctionAsync() As Task(Of String)
    'This Task.Run lambda statement could contain any long-running code, and still not block the UI
    Return Task.Run(Of String)(Function() "Message from Task")
End Function

Which is equivalent to:

C# Copy Code
private async void button1_Click(object sender, EventArgs e)
{
    //This call will not block the UI thread
    string taskText = await Task.Run<string>(() => { return "Message from Task"; });
    MessageBox.Show(taskText);
}
Visual Basic Copy Code
Private Async Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    'This call will not block the UI thread
    Dim taskText As String = Await Task.Run(Of String)(Function() "Message from Task")
    MessageBox.Show(taskText)
End Sub

While Task.Run() does generally obsolete the need for Start() and Marshal(), Marshal() may still be used to marshal data from the thread created with Task.Run() over to the UI thread to the UserState event or other events raised by Marshal(), as desired.


PowerTCP in Partial Trust Environments

PowerTCP in Partial Trust Environments
Send comments on this topic

Glossary Item Box

Partial Trust

Partial Trust environments such as shared hosting in ASP.NET limit access to potentially harmful .NET framework classes and methods. Because of this, some additional configuration is required in order to use Dart's components in these restricted environments. When developing a system service, console application, windows forms application, or web application that will run with Full Trust, no additional configuration is necessary.

Background

The Windows API can access system services that a system administrator may not want to expose. For example, a web hosting service may not want hosted code to access the file system. Microsoft calls limiting such access “Code Access Security”, well-documented in the MSDN article Using Code Access Security with ASP.NET.

Dart assemblies are marked with the 'AllowPartiallyTrustedCallers' assembly attribute for use in Partial Trust Environments. Using Dart's components in a Partial Trust environment requires additional configuration such as installing the component dll into the GAC or creating a custom security policy.

Installation into the GAC

When a Dart assembly is installed into the GAC, the component is granted full trust and asserts the required permissions at runtime so that no custom Security Policy is required. This is the preferred technique for using Dart components in Partial Trust environments.

Custom Security Policies

Security policy files are used to define a permission set that applications running under them can be granted. Under ASP.NET the web.config file can be used to specify which Security Policy should be used. Custom Security Policy files can be used to explicitly grant permissions that are required by the application and its references. However, some .NET Framework features are restricted regardless of Security Policy settings and will typically result in System.Security.SecurityException when used. Because of this, some components may have limited functionality in partial trust environments; if full functionality is required then the Dart component must be installed into the GAC.

Defining a Custom Security Policy

A custom Security Policy should only be used if an application using a Dart component is not run in Full Trust or the Dart component's assembly is not installed into the GAC.

Note: Version numbers mentioned in the following instructions reflect the version of the .NET Framework that permissions are being requested for; if .NET 2.0 is targeted then the appropriate version number should be substituted.

To define a custom Security Policy:

  1. Copy and paste the default web_mediumtrust.config file located at C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web_mediumtrust.config
  2. Rename the copied config file, ex: web_mediumtrust_custom.config

  3. Add the SocketPermission class definition to the SecurityClasses section:

    <SecurityClass
        Name="SocketPermission"
        Description="System.Net.SocketPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

  4. Add SocketPermission to the ASP.NET NamedPermissionSet section:

    <Ipermission
         class="SocketPermission"
         version="1"
         Unrestricted="true" />

  5. Add the UnmanagedCode flag to the SecurityPermision definition:

    <Ipermission
         class="SecurityPermission"
         version="1"
         Flags="UnmanagedCode, Execution, ControlThread, ControlPrincipal, RemotingConfiguration" />

  6. Save the file

Configuring the Security Policy in web.config

To direct an ASP.NET application to use medium trust add the following to the system.web section:

<trust level="Medium"/>

To use a custom Security Policy, add the following to the system.web section:

<securityPolicy>
     <trustLevel name="CustomMedium" policyFile="C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web_mediumtrust_custom.config" />
</securityPolicy>
<trust level="CustomMedium"/>

Alternatively, an assembly that requires full trust can be added to the application's web.config securityPolicy section:

<securityPolicy>
   <fullTrustAssemblies>
     <add assemblyName="Dart.Snmp" version="4.7.0.0" publicKey="00240000048000009400000006020000002400005253413100040000010001003fc01cbb4168cbdbb48a763283bd3a3e48dba81e06c4179db0bf20ba775a188f5c06c7bc1d7f39c22d63a04e3c16b424da9174dc28a019097458bcbea3e0e5184854a07382e3329cf82ce6004731b25eb7b9d56d9682df5606806b894974d0d42b960a2498a756f38904a1cac14e41a9b5debb62276e94e37934d5f1cc9838dd"/>
   </fullTrustAssemblies>
</securityPolicy>

Update the assemblyName, version and publicKey as needed for the product in use. To extract the public key from an assembly, use the 'sn' utility with the '-Tp' option from the Visual Studio command prompt.


Working with MailMessage

Working with MailMessage
Send comments on this topic

Glossary Item Box

This topic provides background for creating and examining messages using the MailMessage object.

Creating a Basic Message - Headers, Text, Attachments

There are three ways to create a MailMessage object in Mail for .NET:

  1. From a Stream or file containing an encoded message
  2. From an existing System.Net.Mail.MailMessage object
  3. From scratch (by composing it in code)

The first two methods involve decoding existing messages from some other format. This topic will focus on the third method - creating a message from scratch.

Most mail messages consist of three major components: the headers, the text message, and attachments. This section examines these components.

Headers

The header fields (headers) contain important information related to the content of the message. The MailMessage object contains properties for required and commonly used header fields.

Recipients: There are three properties to set recipients - To, Cc and Bcc. Set the appropriate property to specify a recipient. To is for recipients directly affected by the message. Cc (Carbon Copy) is for recipients who should see the message but are not directly affected. Bcc (Blind Carbon Copy) is for recipients who should be hidden from other recipients (these recipients will receive the message, but other recipients will not know they have).

Sender: Set the From property to specify the sender of the message.

Subject: Set the Subject property to specify the message subject. Typically this is a summary of the content.

The MailMessage also has properties for Priority, ReplyTo and Date, but it is generally not required or necessary to change their default values.

Text Message

Set MailMessage.Text to add unformatted text to the message. The "HTML Messages" section below discusses HTML text.

Attachments

Attachments are included files that may be saved to disk when a message is received. To add an attachment to a message, create an Attachment object using a local file path, and add it to the MailMessage.Attachments collection.

Example Code

This example creates a simple text message with one attachment.

C# Copy Code
private MailMessage CreateMailMessageWithAttachment()
{
    MailMessage message = new MailMessage();
    message.To = "to@dart.com";
    message.From = "from@dart.com";
    message.Subject = "This is a simple message";
    message.Text = "Please see the attached file.";
    message.Attachments.Add(new Attachment("C:\\File\\myAttachment.jpg"));
    return message;
}
Visual Basic Copy Code
Private Function CreateMailMessageWithAttachment() As MailMessage
    Dim message As New MailMessage()
    message.To = "to@dart.com"
    message.From = "from@dart.com"
    message.Subject = "This is a simple message"
    message.Text = "Please see the attached file."
    message.Attachments.Add(New Attachment("C:\File\myAttachment.jpg"))
    Return message
End Function

Advanced Topics - Custom Headers, Parts Collection

Custom Headers

The Basics section above demonstrates how to add standard headers to a message using properties of the MailMessage object. MailMessage also includes a Headers property which can be used to add custom header lines to the message. Note that all message Parts include the Headers property (and can therefore have customized headers), not just the MailMessage object.

MultipartContent Collection

MailMessage.Parts holds all Parts in the MailMessage, including Textparts (which have string content), Attachments and Resources (which have FileInfo or byte[] content), and Multiparts (which have their own Multipart.Parts collection). The hierarchical structure of a MailMessage is exposed by nested Multipart.Parts collections.

Note that a MailMessage or Multipart with a single Part will encode itself by removing the Multipart "level". In other words, MailMessage will never generate an encoded message containing a Multipart with only one child Part.

Example Code

This example demonstrates custom Headers and the Multipart.Parts collection. Custom header fields are added to the MailMessage and its Parts. Textparts are added to a Multipart, which is in turn added to the MailMessage. A Resource part is also added to the MailMessage.

C# Copy Code
private MailMessage addCustomParts(MailMessage message)
{
    //Add custom header field to message
    message.Headers.Add("X-Alt-Message", new HeaderField("X-Alt-Message", "Message with Alternatives"));

    //Create and add alternative parts to a multipart part
    Textpart part1 = new Textpart("This is alternative 1.");
    part1.Headers.Add("X-Alt", new HeaderField("X-Alt", "Alternative 1"));

    Textpart part2 = new Textpart("This is alternative 2.");
    part2.Headers.Add("X-Alt", new HeaderField("X-Alt", "Alternative 2"));

    Multipart multipart = new Multipart(Multipart.Alternative);
    multipart.Parts.Add(part1);
    multipart.Parts.Add(part2);

    //Add a MultiPart to the MailMessage
    message.Parts.Add(multipart);

    //Add a Resource part to the MailMessage
    Resource resource = new Resource(new FileStream(Application.StartupPath + "\\myImage.jpg", FileMode.Open), "myImage.jpg");
    resource.ContentType = new ContentType("image/jpeg");
    resource.ContentId = "<myImage>";
    message.Parts.Add(resource);
    return message;
}
Visual Basic Copy Code
Private Function addCustomParts(ByVal message As MailMessage) As MailMessage
    'Add custom header field to message
    message.Headers.Add("X-Alt-Message", New HeaderField("X-Alt-Message", "Message with Alternatives"))

    'Create and add alternative parts to a multipart part
    Dim part1 As New Textpart("This is alternative 1.")
    part1.Headers.Add("X-Alt", New HeaderField("X-Alt", "Alternative 1"))

    Dim part2 As New Textpart("This is alternative 2.")
    part2.Headers.Add("X-Alt", New HeaderField("X-Alt", "Alternative 2"))

    Dim multipart As New Multipart(Dart.Mail.Multipart.Alternative)
    multipart.Parts.Add(part1)
    multipart.Parts.Add(part2)

    'Add a MultiPart to the MailMessage
    message.Parts.Add(multipart)

    'Add a Resource part to the MailMessage
    Dim resource As New Resource(New FileStream(Application.StartupPath & "\myImage.jpg", FileMode.Open), "myImage.jpg")
    resource.ContentType = New ContentType("image/jpeg")
    resource.ContentId = "<myImage>"
    message.Parts.Add(resource)
    Return message
End Function

HTML Messages

HTML is used in messages that benefit from formatted text and images. This method adds a multipart/related part to an existing multipart/alternative message.

C# Copy Code
private MailMessage addHtml(MailMessage message)
{
    string html = "This is my HTML message. It contains a couple of images." +
        "<img alt='image1.jpg' src='image1.jpg' />" +
        "<img alt='image2.jpg' src='image2.jpg' />";

    message.Parts.Add(new Multipart(null, html, new DirectoryInfo("C:\\Html Resources\\images").GetFiles()));
    return message;
}
Visual Basic Copy Code
Private Function addHtml(ByVal message As MailMessage) As MailMessage
    Dim html As String = "This is my HTML message. It contains a couple of images." & "<img alt='image1.jpg' src='image1.jpg' />" & "<img alt='image2.jpg' src='image2.jpg' />"

    message.Parts.Add(New Multipart(Nothing, html, New DirectoryInfo("C:\Html Resources\images").GetFiles()))
    Return message
End Function

Encoding and Decoding

Sending or Saving a Message

PowerTCP Mail for .NET features "on-the-fly" encoding/decoding for a minimal memory/disk footprint. Encoding occurs when the Smtp component Sends a MailMessage to a mail server, when Save stores the message to disk or a Stream, and when ToString transforms the message to an encoded string.

Accessing Parts

All messages (including non-MIME messages) decode to MailMessage objects with a MIME structure. A MIME message contains parts which may hold data or parts of their own. The Parts property uses Filter to access different types of parts, including Attachment, Resource, Multipart, Textpart and Htmlpart, with a recursive option.

All Parts contain a Headers property, which is a Dictionary indexed by HeaderField.Name (for example, "Content-Type"). Many header fields are accessible as properties on the Part itself. For example, Textpart includes ContentType and ContentTransferEncoding properties. This is true for MailMessage as well (To, From, etc. See "Creating a Basic Message" above).

Parts provide a Content property to access the part's contents. Textpart.Content is a String, whereas Attachment.Content is a FileInfo and Resource.Content is a byte[]. MailMessage and Multipart objects contain a Parts collection instead of a Content property.

Saving Attachments and Resources

When a message is decoded, attachments are saved to Attachment.Directory, or stored in memory when the static Attachment.DecodeToMemory is true. When Attachment.DecodeToMemory is false, Attachment.Content.MoveTo() can be used to move the attachment to a permanent location. Attachment.GetContentStream() may be used to access the stream containing the file data when Attachment.DecodeToMemory is true. MailMessage.Attachments returns a flat list of all attachments contained in the email.

Inline files (parts with a Content Disposition header of 'inline') are represented by the Resource class and are only decoded to memory. Resource.Content returns a byte array containing the file data.

Example Code

C# Copy Code
private void SaveAttachments(MailMessage message, string saveDirectory)
{
    foreach (Attachment attachment in message.Attachments)
        attachment.Content.CopyTo(System.IO.Path.Combine(saveDirectory, attachment.FileName));
}
//If Attachment.DecodeToMemory was set to true in your application:
private void SaveAttachmentsFromMemory(MailMessage message, string saveDirectory)
{
    //Stream.CopyTo() used here is only available in .NET 4.0 and up
    foreach (Attachment attachment in message.Attachments)
        using (FileStream fs = new FileStream(Path.Combine(saveDirectory, attachment.FileName), FileMode.CreateNew, FileAccess.Write))
            attachment.GetContentStream().CopyTo(fs);
}
//Saves inline files (files intended for display within the HTML message body)
private void SaveInlineFiles(MailMessage message, string saveDirectory)
{
    foreach (Resource res in message.Resources)
        using (FileStream fs = new FileStream(Path.Combine(saveDirectory, res.ContentType.Name), FileMode.CreateNew, FileAccess.Write))
            fs.Write(res.Content, 0, res.Content.Length);
}
Visual Basic Copy Code
Private Sub SaveAttachments(ByVal message As MailMessage, ByVal saveDirectory As String)
    For Each attachment As Attachment In message.Attachments
        attachment.Content.CopyTo(System.IO.Path.Combine(saveDirectory, attachment.FileName))
    Next attachment
End Sub
'If Attachment.DecodeToMemory was set to true in your application:
Private Sub SaveAttachmentsFromMemory(ByVal message As MailMessage, ByVal saveDirectory As String)
    'Stream.CopyTo() used here is only available in .NET 4.0 and up
    For Each attachment As Attachment In message.Attachments
        Using fs As New FileStream(Path.Combine(saveDirectory, attachment.FileName), FileMode.CreateNew, FileAccess.Write)
            attachment.GetContentStream().CopyTo(fs)
        End Using
    Next attachment
End Sub
'Saves inline files (files intended for display within the HTML message body)
Private Sub SaveInlineFiles(ByVal message As MailMessage, ByVal saveDirectory As String)
    For Each res As Resource In message.Resources
        Using fs As New FileStream(Path.Combine(saveDirectory, res.ContentType.Name), FileMode.CreateNew, FileAccess.Write)
            fs.Write(res.Content, 0, res.Content.Length)
        End Using
    Next res
End Sub

Cloning Messages

Use MailMessage.Clone to create an exact copy of a MailMessage. Use a MailMessage as a template to create new messages or to create "Reply" or "Forward" messages as demonstrated in the code below.

C# Copy Code
private MailMessage createCustomReplyMessage(MailMessage originalMessage, string replyText, string fromAddress)
{
    //Clone the original message
    MailMessage replyMessage = originalMessage.Clone() as MailMessage;

    //Set the recipient address
    if (!String.IsNullOrWhiteSpace(replyMessage.ReplyTo))
        replyMessage.To = replyMessage.ReplyTo;
    else if (!String.IsNullOrWhiteSpace(replyMessage.From))
        replyMessage.To = replyMessage.From;

    //Set the sender's address
    replyMessage.From = fromAddress;

    //Indicate that this is a reply in the subject
    replyMessage.Subject = "Re: " + originalMessage.Subject;

    //Clear some properties of the message
    replyMessage.ReplyTo = "";
    replyMessage.Cc = "";
    replyMessage.Sender = "";

    //Set the message text to be the reply followed by some of the original
    //message's header fields and the original text
    string messageText = replyText + Environment.NewLine + Environment.NewLine;
    messageText += "From: " + originalMessage.From + Environment.NewLine;
    messageText += "Sent: " + originalMessage.Date.ToString() + Environment.NewLine;
    messageText += "To: " + originalMessage.To + Environment.NewLine;
    messageText += "Subject: " + originalMessage.Subject + Environment.NewLine + Environment.NewLine;

    //Set the plain text
    replyMessage.Text = messageText + originalMessage.Text;

    //Set the HTML text
    string html = originalMessage.Html;

    //Locate place in HTML string to insert reply text
    int textStartIndex = html.ToLower().IndexOf("<body");
    if (textStartIndex == -1)
        textStartIndex = html.ToLower().IndexOf("<html");
    textStartIndex = html.IndexOf(">", textStartIndex) + 1;

    //Insert reply text into HTML string and set the Body.Html
    messageText = "<div style=\"color:black\">" + messageText.Replace("\r\n", "<br />") + "</div>";
    html = html.Insert(textStartIndex, messageText);
    replyMessage.Html = html;
    return replyMessage;
}
Visual Basic Copy Code
Private Function createCustomReplyMessage(ByVal originalMessage As MailMessage, ByVal replyText As String, ByVal fromAddress As String) As MailMessage
    'Clone the original message
    Dim replyMessage As MailMessage = TryCast(originalMessage.Clone(), MailMessage)

    'Set the recipient address
    If Not String.IsNullOrWhiteSpace(replyMessage.ReplyTo) Then
        replyMessage.To = replyMessage.ReplyTo
    ElseIf Not String.IsNullOrWhiteSpace(replyMessage.From) Then
        replyMessage.To = replyMessage.From
    End If

    'Set the sender's address
    replyMessage.From = fromAddress

    'Indicate that this is a reply in the subject
    replyMessage.Subject = "Re: " & originalMessage.Subject

    'Clear some properties of the message
    replyMessage.ReplyTo = ""
    replyMessage.Cc = ""
    replyMessage.Sender = ""

    'Set the message text to be the reply followed by some of the original
    'message's header fields and the original text
    Dim messageText As String = replyText & Environment.NewLine & Environment.NewLine
    messageText &= "From: " & originalMessage.From & Environment.NewLine
    messageText &= "Sent: " & originalMessage.Date.ToString() & Environment.NewLine
    messageText &= "To: " & originalMessage.To & Environment.NewLine
    messageText &= "Subject: " & originalMessage.Subject & Environment.NewLine & Environment.NewLine

    'Set the plain text
    replyMessage.Text = messageText & originalMessage.Text

    'Set the HTML text
    Dim html As String = originalMessage.Html

    'Locate place in HTML string to insert reply text
    Dim textStartIndex As Integer = html.ToLower().IndexOf("<body")
    If textStartIndex = -1 Then
        textStartIndex = html.ToLower().IndexOf("<html")
    End If
    textStartIndex = html.IndexOf(">", textStartIndex) + 1

    'Insert reply text into HTML string and set the Body.Html
    messageText = "<div style=""color:black"">" & messageText.Replace(vbCrLf, "<br />") & "</div>"
    html = html.Insert(textStartIndex, messageText)
    replyMessage.Html = html
    Return replyMessage
End Function

S/MIME

The S/MIME Overview page provides a background on signing and encrypting messages using S/MIME.

MailMessage provides three methods for encoding and decoding S/MIME messages. SecureSign signs a message using a certificate specifically issued for the sender's email address. SecureEncrypt encrypts a message using a certificate issued for the recipient's email address. SecureDecode decodes a signed and/or encrypted message. All three methods have a parameterless overload that automatically searches the appropriate certificate store for a matching email certificate. The code below demonstrates each method overload with parameters.

C# Copy Code
private MailMessage getSignedMessage(MailMessage message)
{
    //Find the signing certificate in the "CurrentUser/My" certificate store
    //The following code results in the same signed message as "message.SecureSign();"
    X509Store myPersonalStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
    myPersonalStore.Open(OpenFlags.ReadOnly);
    foreach (X509Certificate2 certificate in myPersonalStore.Certificates)
    {
        if (certificate.Subject.Contains("E=" + message.From.ToString()))
        {
            //Sign the message
            message.SecureSign(certificate, X509IncludeOption.ExcludeRoot, DigestAlgorithm.Sha1, true, false);
            return message;
        }
    }
    return null;
}
C# Copy Code
private MailMessage getEncryptedMessage(MailMessage message)
{
    //Find the encrypting certificate in the CurrentUser/AddressBook store
    //The following code results in the same encrypted message as "message.SecureEncrypt();"
    X509Certificate2Collection encryptingCertificates = new X509Certificate2Collection();
    X509Store addressBookStore = new X509Store(StoreName.AddressBook, StoreLocation.CurrentUser);
    addressBookStore.Open(OpenFlags.ReadOnly);
    foreach (X509Certificate2 certificate in addressBookStore.Certificates)
    {
        if (certificate.Subject.Contains("E=" + message.To))
        {
            encryptingCertificates.Add(certificate);
            //Encrypt the message
            message.SecureEncrypt(encryptingCertificates, EncryptingAlgorithm.TripleDes, false);
            return message;
        }
    }
    return null;
}
C# Copy Code
private MailMessage getDecodedMessage(MailMessage message)
{
    //Load the decrypting certificate from an exported certificate file (may also be loaded from an X509Store)
    X509Certificate2 decryptingCertificate = new X509Certificate2(Application.StartupPath + "\\myCertificate.pfx");
    //Decode the message and import the signing certificate into the AddressBook certificate Store
    //(If the decrypting certificate is already present in the "MY" certificate store,
    //the parameterless SecureDecode() may be used instead.)
    SignerInfoCollection signatories = message.SecureDecode(new X509Certificate2Collection(decryptingCertificate), true);
    //Optionally verify the signature and validate the certificate
    foreach (SignerInfo signator in signatories)
        signator.CheckSignature(false);
    return message;
}
Visual Basic Copy Code
Private Function getSignedMessage(ByVal message As MailMessage) As MailMessage
    'Find the signing certificate in the "CurrentUser/My" certificate store
    'The following code results in the same signed message as "message.SecureSign();"
    Dim myPersonalStore As New X509Store(StoreName.My, StoreLocation.CurrentUser)
    myPersonalStore.Open(OpenFlags.ReadOnly)
    For Each certificate As X509Certificate2 In myPersonalStore.Certificates
        If certificate.Subject.Contains("E=" & message.From.ToString()) Then
            'Sign the message
            message.SecureSign(certificate, X509IncludeOption.ExcludeRoot, DigestAlgorithm.Sha1, True, False)
            Return message
        End If
    Next certificate
    Return Nothing
End Function
Visual Basic Copy Code
Private Function getEncryptedMessage(ByVal message As MailMessage) As MailMessage
    'Find the encrypting certificate in the CurrentUser/AddressBook store
    'The following code results in the same encrypted message as "message.SecureEncrypt();"
    Dim encryptingCertificates As New X509Certificate2Collection()
    Dim addressBookStore As New X509Store(StoreName.AddressBook, StoreLocation.CurrentUser)
    addressBookStore.Open(OpenFlags.ReadOnly)
    For Each certificate As X509Certificate2 In addressBookStore.Certificates
        If certificate.Subject.Contains("E=" & message.To) Then
            encryptingCertificates.Add(certificate)
            'Encrypt the message
            message.SecureEncrypt(encryptingCertificates, EncryptingAlgorithm.TripleDes, False)
            Return message
        End If
    Next certificate
    Return Nothing
End Function
Visual Basic Copy Code
Private Function getDecodedMessage(ByVal message As MailMessage) As MailMessage
    'Load the decrypting certificate from an exported certificate file (may also be loaded from an X509Store)
    Dim decryptingCertificate As New X509Certificate2(Application.StartupPath & "\myCertificate.pfx")
    'Decode the message and import the signing certificate into the AddressBook certificate Store
    '(If the decrypting certificate is already present in the "MY" certificate store,
    'the parameterless SecureDecode() may be used instead.)
    Dim signatories As SignerInfoCollection = message.SecureDecode(New X509Certificate2Collection(decryptingCertificate), True)
    'Optionally verify the signature and validate the certificate
    For Each signator As SignerInfo In signatories
        signator.CheckSignature(False)
    Next signator
    Return message
End Function


Globalization Notes

Globalization Notes
Send comments on this topic

Glossary Item Box

The MailMessage class fully supports international standards for encoding and decoding.

RFC 822/2822 Encoding Standards

An encoded MailMessage will typically contain 7-bit ASCII characters because mail servers and the internet in general only guarantee 7-bit support. PowerTCP defaults to 7-bit encoding for compatibility purposes, but 8-bit encodings may be specified if a full 8-bit path (servers, routers, etc) is known to exist.

Header Encoding

Header fields support the encoding of 16-bit UNICODE characters, so non-english text such as "メールテスト" can be included in subject lines or email addresses. This is accomplished using encoded-word syntax, which can be used to encode any UNICODE string. The encoding specified by Header.Encoding is used to encode these UNICODE strings into 8-bit bytes and then BASE64 is used to convert that into 7-bit ASCII characters.

Header Decoding

Header decoding is usually a straight-forward matter of decoding an encoded-word string, but some clients may send emails containing out-of-spec 8-bit headers, resulting in the non-ASCII data displaying as question marks. To handle these out-of-spec emails, the value of EncodingMap["headers"] may be changed to any system encoding to use a non-ASCII decoder for header data.

Transfer Encoding

Multipart MIME supports the transfer of binary data by standardizing the encoding of parts and attachments. PowerTCP Mail for .NET supports the older UUENCODE standard as well as modern encoding standards (BASE64 and Quoted-Printable). BASE64 typically uses a fixed-length 76 ASCII character line to encode binary data. Quoted-Printable encodes some 7-bit and all 8-bit values so the encoded result is generally human-readable.

Character Encoding

UNICODE strings (16-bit characters) must be encoded (just like binary data). This is automatically handled by the component, using Textpart.Encoding to encode the text string into 7-bit ASCII characters or 8-bit bytes (depending on the encoding specified) and then transfer-encoded depending on the value of Resource.TransferEncoding.

Character Decoding

String decoding is usually a straight-forward matter of using the character encoding specified in the part's Content-Type header field, but some emails are slightly off-spec. For this reason PowerTCP Mail for .NET includes an EncodingMap that allows any specified charset to be mapped to a system encoding. This allows developers to compensate somewhat for third-party email software that uses non-standard charset strings.


Anti-Virus Notes

Anti-Virus Notes
Send comments on this topic

Glossary Item Box

Anti-virus software can quarantine suspect files when they are created. This can have undesirable effects for email decoding, such as when file attachments are decoded and streamed to disk.

After the file is quarantined, any attempt to access the file will cause an exception to be thrown (such as a FileNotFoundException or UnauthorizedAccessException). This exception can be caught, and an indication given to the user that the attachment may have been removed by third-party software. If access to the file is desired regardless of its content, setting Attachment.DecodeToMemory to true may allow you to circumvent the anti-virus. Attachments will be stored in memory (instead of on disk) and can be accessed using Attachment.GetContentStream().


OAuth Overview

OAuth Overview
Send comments on this topic

Glossary Item Box

OAuth

OAuth usage is implemented by obtaining an access token through the server's OAuth interface, and using that access token to log into the server, as demonstrated against our component below (the implementation is identical for SMTP/POP):

Imap Authentication with OAuth Copy Code
/// <summary>
/// Connects to an Imap server, and authenticates the user using OAuth.
/// </summary>
/// <param name="myImap">The Imap instance to connect and authenticate</param>
/// <param name="hostNameOrAddress">The server's hostname or IP address.</param>
/// <param name="emailAddress">The user's email address.</param>
/// <param name="accessToken">An access token provided by the server's OAuth interface.</param>
public void AuthenticateWithOAuth(Imap myImap, string hostNameOrAddress, string emailAddress, string accessToken)
{
    //Set the method of encryption - Implicit/Explicit
    myImap.Session.Security.Encrypt = Encrypt.Implicit;

    //Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
    //TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
    myImap.Session.Security.Protocols = SslProtocols.Ssl3 | SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;

    //Specify the server certificate validation callback
    myImap.Session.Security.ValidationCallback = remoteCertificateValidation;

    //Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    //GetDefaultPort() returns the common port used for the security configuration.
    myImap.Session.RemoteEndPoint = new IPEndPoint(hostNameOrAddress, Imap.GetDefaultPort(myImap.Session));

    //Connect to the server.
    myImap.Connect();

    //Authenticate the user.
    //OAuth2 isn't used automatically by Authentication.Auto, so must be specified:
    myImap.Session.Authentication = Authentication.OAuth2;
    myImap.Session.Username = emailAddress;
    myImap.Session.Password = accessToken;
    myImap.Authenticate();
}

private bool remoteCertificateValidation(Object sender, X509Certificate remoteCertificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    //the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    return true;
}
Imap Authentication with OAuth Copy Code
''' <summary>
''' Connects to an Imap server, and authenticates the user using OAuth.
''' </summary>
''' <param name="myImap">The Imap instance to connect and authenticate</param>
''' <param name="hostNameOrAddress">The server's hostname or IP address.</param>
''' <param name="emailAddress">The user's email address.</param>
''' <param name="accessToken">An access token provided by the server's OAuth interface.</param>
Public Sub AuthenticateWithOAuth(ByVal myImap As Imap, ByVal hostNameOrAddress As String, ByVal emailAddress As String, ByVal accessToken As String)
    'Set the method of encryption - Implicit/Explicit
    myImap.Session.Security.Encrypt = Encrypt.Implicit

    'Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
    'TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
    myImap.Session.Security.Protocols = SslProtocols.Ssl3 Or SslProtocols.Tls Or SslProtocols.Tls11 Or SslProtocols.Tls12

    'Specify the server certificate validation callback
    myImap.Session.Security.ValidationCallback = AddressOf remoteCertificateValidation

    'Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    'GetDefaultPort() returns the common port used for the security configuration.
    myImap.Session.RemoteEndPoint = New IPEndPoint(hostNameOrAddress, Imap.GetDefaultPort(myImap.Session))

    'Connect to the server.
    myImap.Connect()

    'Authenticate the user.
    'OAuth2 isn't used automatically by Authentication.Auto, so must be specified:
    myImap.Session.Authentication = Authentication.OAuth2
    myImap.Session.Username = emailAddress
    myImap.Session.Password = accessToken
    myImap.Authenticate()
End Sub

Private Function remoteCertificateValidation(ByVal sender As Object, ByVal remoteCertificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    'the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    Return True
End Function

Obtaining an Access Token

Examine your server's documentation for current information on how to acquire an access token through their interface. Implementation will vary by server; we demonstrate against Gmail's API in this topic. See Google's documentation on how to acquire developer credentials (client_secret.json) and download the Gmail API here.

The snippet below demonstrates simple usage in an environment that a web browser can launch within (such as Windows Forms):

Obtain a Gmail Access Token Copy Code
/// <summary>
/// Gets an OAuth access token for the user's Gmail account.
/// </summary>
/// <param name="emailAddress">The user's Gmail address/username</param>
/// <returns>An OAuth access token.</returns>
/// <remarks>
/// Launches a web browser for the user to verify the application's access to their account.
/// Targets Google.Apis.Gmail.v1 1.10.1.425. May not be compatible with later versions.
/// </remarks>
public async Task<string> GetGmailOAuthAccessTokenAsync(string emailAddress)
{
    UserCredential credential;
    //client_secrets.json - The Gmail developer credentials file.
    //For more information see Google's documentation:
    //https://developers.google.com/gmail/api/quickstart/dotnet
    using (FileStream fs = File.OpenRead("client_secrets.json"))
    {
        credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
            GoogleClientSecrets.Load(fs).Secrets,
            new[] { GmailService.Scope.MailGoogleCom },
            emailAddress, CancellationToken.None);
    }
    return await credential.GetAccessTokenForRequestAsync(null, CancellationToken.None);
}
Obtain a Gmail Access Token Copy Code
''' <summary>
''' Gets an OAuth access token for the user's Gmail account.
''' </summary>
''' <param name="emailAddress">The user's Gmail address/username</param>
''' <returns>An OAuth access token.</returns>
''' <remarks>
''' Launches a web browser for the user to verify the application's access to their account.
''' Targets Google.Apis.Gmail.v1 1.10.1.425. May not be compatible with later versions.
''' </remarks>
Public Async Function GetGmailOAuthAccessTokenAsync(ByVal emailAddress As String) As Task(Of String)
    Dim credential As UserCredential
    'client_secrets.json - The Gmail developer credentials file.
    'For more information see Google's documentation:
    'https://developers.google.com/gmail/api/quickstart/dotnet
    Using fs As FileStream = File.OpenRead("client_secrets.json")
        credential = Await GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(fs).Secrets, { GmailService.Scope.MailGoogleCom }, emailAddress, CancellationToken.None)
    End Using
    Return Await credential.GetAccessTokenForRequestAsync(Nothing, CancellationToken.None)
End Function

For other application types such as ASP.NET, see Google's documentation and snippets here, and the reference documentation for their UserCredential and ServiceAccountCredential classes linked within for information on the methods used to acquire the access token.


Security Overview

Security Overview
Send comments on this topic

Glossary Item Box

What is a digital certificate?

Authentication is important for secure communications. Users must be able to prove their identity to the entities they are communicating with. In addition they must be able to verify the identity of the entity communicating with them. This is accomplished by presenting or verifying some form of trusted credentials.

A digital certificate is a common credential that provides authentication. A trusted organization, called a Certificate Authority (CA), assigns a certificate to a user or entity and the user or entity then uses the certificate to prove itself to the other side. A system may be configured your to accept any number of Certificate Authorities. Complete the following steps to access the Certificates dialog box:

  1. In the Control Panel, select Internet Options.
  2. Select the Content tab, and then click Certificates.

Where do I get a certificate?

Certificates must come from a trusted CA. A user submits a certificate request to a CA and the CA returns a certificate for the user to use. Listed below are some Certificate Authorities:

  • Microsoft Certificate Server - used for internal corporate Certificate delegation
  • VeriSign - (www.verisign.com) provides certificates for Internet users and servers

A digital certificate is always required for an application to operate as a secure server. A digital certificate is only required on the client if the server requests authentication.

How does the authentication process work?

  1. The client normally initiates the TCP connection. PowerTCP components make this connection, send a "client hello" message, and automatically respond to authentication requests received from the server.
  2. The server accepts the connection initiated by the client, constructs its digital credentials, and sends its credentials to the client.
  3. Optionally, the server may send an authentication request to the client.
  4. The client receives the server's credentials, verifies them against the CAs it is configured to trust, and responds with its own credentials if an authentication request is received.
  5. If the client and server cannot negotiate a mutually acceptable security protocol, an error is generated and the connection is closed.
  6. If the client cannot validate the server's credentials, an error is generated and the client closes the connection.
  7. If the server cannot validate the client's credentials (if requested), an error is generated and the server closes the connection.
  8. Once protocol negotiation and authentication is successful, secure encryption/decryption is performed on all data passing over the connection.
  9. The session is terminated when one side closes the connection.

What is a certificate store?

A certificate store is a location on the system (memory, disk, registry, etc.) where certificates are stored for use. There are three major system stores and other minor stores. The three major stores are:

  • MY - personal certificates go here
  • ROOT - certificates for Trusted Root Certificate Authorities
  • CA - all other certificates

There are other certificate stores. For example, the store "SPC" contains software publisher's certificates.

What are the system store and the machine store?

The system store is the certificate store located in the HKEY_CURRENT_USER registry key. The machine store is the certificate store located in the HKEY_LOCAL_MACHINE registry key. Applications installed as a service should store their certificates in the machine store since there is no current user when running as a service.

What is the X500 naming convention?

This is a format for creating a distinguished name. The different parts of the name are described below:

  • C - country you are in (ex. US)
  • S - state you are in (ex. New York)
  • L - locality value or city (ex. Syracuse)
  • O - your organization (ex. Dart)
  • OU - organizational unit (ex. Development)
  • CN - common name; typically the name of the system or user (Ex. MyMachine)

Here are some examples of X500 names:

  • C=US, S=New York, L=Syracuse, O=Dart, OU=Development, CN=My Machine
  • C=US, S=Georgia, L=Atlanta, O=MyOrg, OU=Toy Department, CN=John Doe


Security Implementation

Security Implementation
Send comments on this topic

Glossary Item Box

Client Security

AuthenticateAsClient() is used by client components to perform authentication after connecting to a server. For our Tcp component, this must be called directly, while for our application-layer protocol components, it will be called automatically after the connection is established when SSL is enabled.

When AuthenticateAsClient() is called (either directly, or through top-level methods that will utilize it), two things may occur:

The server presents a certificate:

This will raise the RemoteCertificateValidationCallback specified by Tcp.Session.Security.ValidationCallback. This callback must be in the format:

C# Copy Code
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
bool RemoteCertificateValidation(
    Object sender,
    X509Certificate remoteCertificate,
    X509Chain chain,
    SslPolicyErrors sslPolicyErrors)
{
    ...
}
Visual Basic Copy Code
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates
Function RemoteCertificateValidation( _
    ByVal sender As Object, _
    ByVal remoteCertificate As X509Certificate, _
    ByVal chain As X509Chain, _
    ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    ...
End Function

Return true to accept the certificate, and false to refuse it. A value other than SslPolicyErrors.None for sslPolicyErrors indicates an issue with the certificate that the server presented. A flag of SslPolicyErrors.RemoteCertificateChainErrors indicates that chain.ChainStatus should be checked; enumerate through chain.ChainStatus, and check the value of chain.ChainStatus[index].Status for additional details.

During authentication, the remote certificate's common name (CN) (usually the server's fully qualified domain name) is compared to the value of ClientSecurity.TargetHost. If the values do not match, sslPolicyErrors will contain the SslPolicyErrors.RemoteCertificateNameMismatch flag. When ClientSecurity.TargetHost is left empty, Tcp.Session.RemoteEndPoint.HostNameOrAddress will be used instead.

The server requests a certificate:

AuthenticateAsClient() first checks if Tcp.Session.Security.SelectionCallback is null. If it is not null, that LocalCertificateSelectionCallback will be raised. This callback must be in the format:

C# Copy Code
using System.Security.Cryptography.X509Certificates;
X509Certificate LocalCertificateSelection(
    Object sender,
    string targetHost,
    X509CertificateCollection localCertificates,
    X509Certificate remoteCertificate,
    string[] acceptableIssuers)
{
    ...
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Function LocalCertificateSelection( _
    ByVal sender As Object, _
    ByVal targetHost As String, _
    ByVal localCertificates As X509CertificateCollection, _
    ByVal remoteCertificate As X509Certificate, _
    ByVal acceptableIssuers() As String) As X509Certificate
    ...
End Function

Return a certificate within the callback, and that certificate will be used for authentication. Certificates may be accessed from the certificate store with the System.Security.Cryptography.X509Certificates.X509Store class:

C# Copy Code
using System.Security.Cryptography.X509Certificates;
//The X509Store constructor overloads may be used to access different certificate stores
X509Store certificateStore = new X509Store();
certificateStore.Open(OpenFlags.ReadOnly);
X509Certificate2 cert = certificateStore.Certificates[0];
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
'The X509Store constructor overloads may be used to access different certificate stores
Dim certificateStore As New X509Store()
certificateStore.Open(OpenFlags.ReadOnly)
Dim cert As X509Certificate2 = certificateStore.Certificates(0)

For a demonstration of selecting a certificate from the certificate store interactively, please see the CertificateListForm included with our samples.

If Tcp.Session.Security.SelectionCallback is null, AuthenticateAsClient() will examine Tcp.Session.Security.Certificates for a valid certificate; the first certificate in the collection that passes Microsoft's validation checks will be used for authentication.

Server Security

For our server component, Tcp.AuthenticateAsServer(ServerSecurity) may be called after the client connects. ServerSecurity.ValidationCallback is identical to the client ValidationCallback, and will be raised when the client presents a certificate.

Set the ServerSecurity.Certificate property to specify the certificate to use for authentication.

Security Protocol

The security protocol used will be automatically negotiated; to specify the protocols available for negotiation, Security.Protocols may be set to any combination of the SslProtocols enumeration.

Explicit/Implicit

Explicit security means that the initial connection to the server is not encrypted. After connecting, a command such as STARTTLS or STLS is sent by the client to the server per the protocol, and a secure connection is negotiated. Because explicit security is initiated after the STARTTLS command is sent, servers are able to accept explicit connections on the same port that accepts non-secure connections.

Implicit security means that the client and server will negotiate a secure connection when the connection is established. Because of this, a port is typically dedicated for implicit connections.

Explicit/Implicit implementation is protocol-specific; application-layer protocols such as Ftp, Imap, Smtp and Pop implement it, while upper-layer protocols such as Tcp and Udp do not. The method of encryption may be configured on our components with a property on Session.Security. The property's name may vary between components, but will always start with 'Encrypt'; for Ftp, this property is Session.Security.EncryptControl, and for our Email components, Session.Security.Encrypt.


Manage Certificates with MMC

Manage Certificates with MMC
Send comments on this topic

Glossary Item Box

This document explains how to use the Microsoft Management Console (MMC) to import and export SSL Certificates. This is only one use for the MMC. Please see the MMC Documentation for more info.

Note: This document assumes the existing certificate is functional on the machine where the exporting takes place.

Start the MMC

The Microsoft Management Console (MMC) is part of Windows 2000 and later. It does not exist in NT or 9x. You may be able to do similar functions using IE, but IE versions vary so it will not be discussed here.

To start the MMC:

  1. Start -> Run -> MMC
  2. Choose File | Add/Remove Snap-in ...
  3. Click Add
  4. Select Certificates from the list and click the Add button
  5. Choose Computer account
  6. Choose Local Computer
  7. Click Close
  8. Click OK
  9. Repeat steps 2-8, substituting 'My user account' in step 5 and skipping step 6
  10. Choose File | Save As ... and save the settings to an .MSC file

In the future you can skip these steps by double-clicking the MSC file or by choosing the MSC from the history under the File menu.

Export an Existing Certificate

Follow these steps to save a certificate to a file. The file can then be used to import the certificate to another machine.

To export an existing certificate:

  1. Start the MMC by following the steps above or by clicking the MSC file saved previously
  2. Locate the Certificate that you wish to export. Certificates are using installed under the Personal ("MY") store in either the Local Machine or Current User stores
  3. Right Click on the certificate and choose All Tasks | Export
  4. Click Next
  5. Check 'Yes, export the private key' (If it's grayed out, the certificate can't be moved to another machine)
  6. Click Next
  7. Leave the Default setting at "Enable Strong Protection"
  8. Click Next
  9. Choose a password and click next
  10. Save the PFX file using a filename
  11. Click Next and you should see the "Completing the Certificate Export Wizard" screen
  12. Click Finish and you are done

The file you just saved can now be moved to another machine.

Import a Certificate

Follow these steps to move a certificate from one machine to another.

To import an existing certificate:

  1. Start the MMC by following the steps above or by clicking the MSC file saved previously
  2. Choose the store that you want to import to (EXAMPLE: Local Computer -> Personal)
  3. Right Click on the store and choose All Tasks | Import
  4. Click Next
  5. Browse to the PFX file that was previously saved
  6. Click Next
  7. Enter the password. If you want to allow the certificate to be exported again, check 'Mark this key as exportable'
  8. Click Next
  9. Check 'Place all certificates in the following store'
  10. Click Browse
  11. Check 'Show physical stores'
  12. Choose 'Personal' to store to the Current User store or 'Personal -> Registry' to store to the Local Machine store
  13. Click OK
  14. Click Finish

The certificate is now usable. However, unless the CA is already trusted (which is the case for major Certificate providers), users will be notified that the certificate itself is not trusted. To resolve this, go to the Website of the Certificate Authority that originally issued the certificate to obtain the CA's root certificate.

Note about importing certificates: PowerTCP requires that a certificate be properly imported into a valid Microsoft Certificate Store. If a certificate was created from a non-MS source (such as OpenSSL) , please be sure to export the certificate properly before importing it into an MS Certificate store. Check the help for whatever SSL system you are using for more information.


Mail Protocols Overview

Mail Protocols Overview
See Also Send comments on this topic

Glossary Item Box

The following guide provides a basic understanding of the protocols and concepts that apply to Internet mail, including SMTP, POP, IMAP, messages and MIME. This guide does not attempt to demonstrate usage of PowerTCP Mail for .NET. For information of this type, see the Assembly Overview.

See Also

Brief History
SMTP Protocol
POP3 Protocol
IMAP4 Protocol
Basic Message Structure
MIME Overview
SMIME Overview


Brief History

Brief History
See Also Send comments on this topic

Glossary Item Box

In the late 70's and early 80's, as ARPANET evolved into the Internet of today, email became a very popular, yet chaotic, application. Popular, because it was viewed as a communications technology that would revolution the way the world exchanged ideas. Chaotic, because it was implemented by countless proprietary email technologies that could not interact with each other. It quickly became clear that a protocol standard was needed to truly make email technology a universal way to exchange ideas.

The Development of Simple Mail Transfer Protocol (SMTP)

Simple Mail Transfer Protocol (SMTP) was developed to be a reliable, efficient and universal way to transport mail. The SMTP model consists of two elements: mail transfer agents (MTAs) and user agents (UAs).

The mail transfer agent has two tasks:

  • To send and receive messages from other mail transfer agents
  • To interface with user agents (clients)

The user agent also has two tasks:

  • To interface with mail transfer agents
  • To provide a user friendly environment, shielding the user from the implementations of SMTP

A universal and (because data is sent over TCP) reliable email implementation is achieved through this model. Though universal, SMTP has two critical limitations:

  1. SMTP can only transport 7-bit data. SMTP was designed to transfer plain ASCII text, which is 7-bit data. MTAs were therefore implemented to carry this form of data. This proved problematic with the advent of multimedia and the preponderance of 8-bit data.
  2. SMTP cannot queue messages at the receiving end. The mail server and associated local mail delivery system were therefore needed to be resident and running at all times on the client. Most smaller computers lacked the resources to have the mail delivery system resident and running. Multiple sustained connections were taking their toll on mail servers as well.

These limitations necessitated the addition of new protocols to handle the receiving of mail. More info about the SMTP Protocol is available in the SMTP Protocol topic.

The Development of Post Office Protocol (POP)

SMTP succeeded in implementing universal, reliable and efficient email transfer. However, the lack of a final "pick up" point resulted in undesirable sustained connections. Post Office Protocol (now in its third version and commonly called POP3) was implemented to provide a common system for queuing and delivering mail to the user agent (client). This protocol called for the creation of a "mail-drop" on the mail server, in which mail, delivered by SMTP, would be placed and held for pickup by the recipient. POP allows a user agent to interface with the mail drop, in the form of logging in, downloading messages and logging out. The implementation of POP was a success, as it did not require the entire mail transfer system to be persistently connected and resident.

The combination of SMTP and POP works well, but is not perfect. The ability to transfer non-ASCII data, and a sophisticated way to manipulate email on the server are still missing. Solutions to these problems were found in the development of Multipurpose Internet Mail Extensions (MIME) and Internet Message Application Protocol (IMAP).

More info about the POP protocol is available in the POP Protocol topic.

The Development of Multipurpose Internet Mail Extensions (MIME)

The development of MIME grew from the extreme limitations of sending only 7-bit ASCII text, especially with the advent of multimedia files. Prior to MIME, sending non-ASCII files was a challenge, as most files are naturally 8-bit. MIME provides a new way to structure messages, as well as algorithms for encoding 8-bit data so that non-ASCII files can be transported.

More info about the MIME is available in the MIME Overview topic.

The Development of Internet Message Application Protocol (IMAP)

POP, while useful in its current function, is still lacking in several areas. POP does not allow for manipulation of email still on the server or for accessing mail from more than one computer (with POP, messages are typically deleted from the mail server after download). IMAP allows messages to be managed through the use of server "mailboxes," which are functionally equivalent to local folders or directories. The user agent has the ability to create, delete and rename mailboxes. It can also move email to different mailboxes, download email, and delete email. Since mail remains on the server, IMAP also allows access from different computers. IMAP is clearly a more sophisticated protocol than POP, but not all mail servers support IMAP, so POP is still very prevalent today.

More info about the IMAP protocol is available in the IMAP4 Protocol topic.

Internet Email Model Today

Today's email model is a hybrid of SMTP, POP, IMAP and MIME (as well as many other technologies). SMTP is used to send messages. POP is used to queue messages on the receiver mail server for downloading. IMAP is used to store messages on the receiver's mail server for server side manipulation. MIME specifies a method of sending non-ASCII data.

See Also

SMTP Protocol
POP3 Protocol
IMAP4 Protocol
Basic Message Structure
MIME Overview
SMIME Overview

Components
Imap
Pop
Smtp


SMTP Protocol

SMTP Protocol
See Also Send comments on this topic

Glossary Item Box

Simple Mail Transfer Protocol (SMTP) is the Internet standard for transmitting email messages from the sender to the recipient's mail server. This is accomplished through the use of mail transfer agents (MTAs) located on the mail server, and user agents (UAs) located on the user's local machine. The job of the MTA is to send and receive mail from other MTAs. The job of the UA is to interface with the MTA and to provide a user friendly environment for the end user.

The SMTP protocol provides a means for transferring messages from mail server to mail server. A server receiving such a transfer may be the message's final destination or merely a relay point. Alternative protocols (POP and IMAP) are used to retrieve email. The SMTP transfer is a three step process: authenticate the sender, send the mail, and close the connection. These processes ensue "lock step," meaning the sender sends a command which the recipient processes and responds to.

The examples that follow show SMTP commands sent between two SMTP mail transfer agents. When using PowerTCP Mail for .NET, all authentication and logging in is automatically handled by the Smtp component.

SMTP Authentication

Prior to authentication, the receiver will (normally) listen on port 587 for TCP connections. Many receivers will also accept connections on port 25, but this port is intended for server to server relaying. Once a connection is made, the sender may issue the HELO command, followed by the sender's domain name. The recipient will in turn identify itself to the sender. The process will look something like this:

Recipient < wait for connection on port 587 >
Sender: < make TCP connection >
Sender: HELO sender.com
Recipient: 250 server1.dart.com

The EHLO command initiates an alternative authentication method. This command is functionally similar to the HELO command, but indicates the sender's desire to use service extensions (these are a way to enhance SMTP and are covered later). Authentication using the EHLO command will look similar to this:

Recipient < wait for connection on port 587 >
Sender: < make TCP connection >
Sender: EHLO sender.com
Recipient: 250 server1.dart.com
250-HELP
250-EXPN
250-XREMOTEQUEUE
250-ETRN
250-PIPELINING
250-SIZE

In this example, the response from the server is the same as with the HELO command except for the inclusion of supported service extensions. At this point the authentication stage is complete, and the sending mail process can continue. With pipe-lining the entire above process takes only one send and receive.

Sending Mail

Once the sender is authenticated, the UA sends the mail message. This is a simple process involving three commands: MAIL FROM, RCPT TO and DATA. First, MAIL FROM, followed by the sender's address, is sent. If the recipient can accept mail, it responds positively with 250 OK. The sender then sends a series of RCPT TO commands, each followed by the address of a mail recipient. The receiver will either accept or reject each mail recipient. If a recipient is rejected, the mail transaction still continues. The sender then sends the DATA command with the actual message. The server responds with a 354 Intermediate reply, and will consider all succeeding lines to be the message. The message includes header fields with labels such as Date, Subject, To, Cc, and From, followed by the message body. When all data has been sent, the sender issues a <CRLF>.<CRLF>, informing the recipient that all data has been transmitted. The DATA command should fail only if the mail transaction was incomplete (for example, no recipients), or if resources are not available on the server. The entire process will look similar to this:

Sender: MAIL FROM: <Smith@Alpha.ARPA>
Recipient: 250 OK
Sender: RCPT TO: <Jones@Beta.ARPA>
Recipient: 250 OK
Sender: RCPT TO: <Green@Beta.ARPA>
Recipient: 550 No such user here
Sender: RCPT TO: <Brown@Beta.ARPA>
Recipient: 250 OK
Sender: DATA
Recipient: 354 Start mail input; end with <CRLF> . <CRLF>
Sender: Blah blah blah...
Sender: ...etc. etc. etc.
Sender: <CRLF>.<CRLF>
Recipient: 250 OK

Once this stage is complete, the mail was sent and the connection must be closed.

Closing the Connection

The sender uses the QUIT command to close the connection. The recipient replies with 221, verifying that the connection is closed. This transaction will look similar to this:

Sender: QUIT
Recipient: 221 closing channel
< TCP connection ended >

The QUIT command signals the end of the mail process.

By default, commands and replies are composed of characters from the US-ASCII (7-bit) character set. If the server supports the extended protocol for an 8-bit byte (octet) transmission channel, it responds with this extension at greeting time. PowerTCP supports 8-bit binary transmissions. When the server accepts and forwards a message containing 8-bit data, any 7-bit only intermediate network segments that detect the impending message may refuse to receive the message. This generally results in the message being returned-to-sender.

SMTP supports other commands in addition to the authentication and sending commands, including:

  • RSET- Resets all data that has been entered into the SMTP server.
  • HELP command-name- Provides syntactical and other information about SMTP commands.
  • VRFY recipient email address- Verifies an address as being acceptable by the system.
  • EXPN alias-name- Expands an alias and returns a list of recipients the alias will send to.

SMTP Sample Dialog

The following example demonstrates a typical dialog between two mail transfer agents transferring mail using SMTP:

Recipient < wait for connection on port 25 >
Sender: < make TCP connection >
Sender: EHLO
Recipient: 250 server1.dart.com
250-HELP
250-EXPN
250-XREMOTEQUEUE
250-ETRN
250-PIPELINING
250-SIZE
Sender: MAIL FROM: <Smith@Alpha.ARPA>
Recipient: 250 OK
Sender: RCPT TO: <Jones@Beta.ARPA>
Recipient: 250 OK
Sender: RCPT TO: <Green@Beta.ARPA>
Recipient: 550 No such user here
Sender: RCPT TO: <Brown@Beta.ARPA>
Recipient: 250 OK
Sender: DATA
Recipient: 354 Start mail input; end with <CRLF> . <CRLF>
Sender: Blah blah blah...
Sender: ...etc. etc. etc.
Sender: <CRLF>.<CRLF>
Recipient: 250 OK
Sender: QUIT
Recipient: 221 closing channel
< TCP connection ended >

A communication log such as this one can be created using the Connection.Log event.

See Also

Brief History
POP3 Protocol
IMAP4 Protocol
Basic Message Structure
MIME Overview
SMIME Overview

Components
Imap
Pop
Smtp


POP3 Protocol

POP3 Protocol
See Also Send comments on this topic

Glossary Item Box

The POP3 protocol is used by a client to access and download messages held temporarily by the mail server. POP was developed largely because SMTP lacks a method for queuing messages on the recipient's mail server. POP provides a system for queuing messages and allows the user to periodically log in to the mail server to download messages. This greatly reduces the strain of maintaining a constant and resident connection on both mail servers and user machines.

A POP session consists of the client and server exchanging commands and responses until the session is terminated. This session can be broken down into three states: authorization state, transaction state, and update state.

POP3 Authorization State

A POP3 session begins with the server (normally) listening for connections on port 110. The authorization state begins when a client makes a TCP connection and the server issues a greeting. The client must issue the USER command followed by its user identification. If the server responds with a positive success indicator ("+OK"), the user may issue the PASS command followed by its password. If the server again issues a positive success indicator ("+OK"), the server acquires the client's associated mail-drop, and the session moves into the transaction state. Here is an example:

Server: <wait for connection on TCP port 110>
Client: <open connection>
Server: +OK dewey POP3 server ready
Client: USER mrose
Server: +OK mrose
Client: PASS secret
Server: +OK mrose's maildrop has 2 messages (320 octets)

The session now enters the transaction state.

POP3 Transaction State

The transaction state consists of the client issuing one of several commands to which the server responds positively or negatively. These commands are used to acquire information about the mail located on the server, or to retrieve mail from the server. Commands include:

  • STAT- The server returns the total number of messages and total size.
  • LIST [msg]- If no argument is given, the server returns a multi-line response enumerating each message and its statistics. If an argument is given, the server simply returns the statistics for the message specified by msg or an error message if the message does not exist.
  • RETR msg- The server returns a multi-line response containing the contents of msg, or an error if the message does not exist.
  • DELE msg- If msg is valid, the message is marked for deletion and a positive response is returned. If the message does not exist or has already been marked for deletion, the server returns an error.
  • NOOP- The server simply responds to this command with a positive response.
  • LAST- The server returns the number of the highest accessed message.
  • RSET- Any messages marked for deletion are unmarked.
  • QUIT- Ends the POP3 session, the server enters the update state.

The transaction state can take many forms. The following shows a typical dialogue between client and server:

Client: STAT
Server: +OK 2 320
Client: LIST
Server: +OK 2 messages (320 octets)
Server: 1 120
Server: 2 200
Server: .
Client: RETR 1
Server: +OK 120 octets
Server: < the POP3 server sends message 1 >
Server: .
Client: DELE 1
Server: +OK message 1 deleted
Client: RETR 2
Server: +OK 200 octets
Server: < the POP3 server sends message 2 >
Server: .
Client: DELE 2
Server: +OK message 2 deleted
Client: QUIT

Once the QUIT command is issued, the transaction state is over and the session moves into the update state.

POP3 Update State

In the update state, the server deletes all messages marked for deletion, releases resources associated with the client's mail-drop, and closes the TCP connection.

For more detailed information about the POP3 protocol, refer to RFC 1939.

See Also

Brief History
SMTP Protocol
IMAP4 Protocol
Basic Message Structure
MIME Overview
SMIME Overview

Components
Imap
Pop
Smtp


IMAP4 Protocol

IMAP4 Protocol
See Also Send comments on this topic

Glossary Item Box

Internet Message Access Protocol (IMAP) allows remote manipulation of messages on the server. IMAP was implemented in response to the shortcomings of POP; including an inability for sophisticated mail manipulation on the server, and restricted access to mail from more than one computer.

Similarly to POP and other protocols, the IMAP server responds to commands issued by the client. Every command is preceded by a unique, client-defined identifier (for example, A0001), which increments with each successive command. These commands allow a client to create and manipulate folders called "mailboxes" on the server in a way that is functionally equivalent to manipulating local folders. As commands are issued, an IMAP4 session progresses through four states: non-authenticated, authenticated, selected and logout.

IMAP4 Non-Authenticated State

When a client makes a TCP connection with the server (typically on port 143), the session enters the non-authenticated state. In this state, the client has access to four commands: CAPABILITY (displays special capabilities of the server), NOOP (causes the server to give a positive response), LOGIN (authenticates the client), and LOGOUT (ends the session). In order for the session to continue, the client must supply authentication credentials with the LOGIN command. Once proper credentials have been supplied, the session moves into the authenticated state.

IMAP4 Authenticated State

In the authenticated state, the client has access to all commands from the non-authenticated state (except for LOGIN). The client can also CREATE a mailbox, get the STATUS of a mailbox, RENAME a mailbox, and perform other commands involving the manipulation of mailboxes. The client may also select a valid mailbox using either the SELECT or the EXAMINE command, followed by a valid mailbox name. SELECT opens the mailbox with read/write privileges, whereas EXAMINE opens the mailbox with read-only privileges. Once one of these commands is executed successfully, the session moves into the selected state.

IMAP4 Selected State

Messages are accessed in the selected state. The client can issue any of the commands from the authenticated state, as well as CLOSE (closes the mailbox and returns to authenticated state), EXPUNGE (removes all messages flagged for deletion), SEARCH (allows the client to find messages using certain criteria), FETCH (returns all or a part of a message), STORE (allows updating of flags stored with each message), and COPY (allows a message set to be copied to a mailbox). From the selected state, the client may use CLOSE to return to the authenticated state, or LOGOUT to go to the logout state.

IMAP4 Logout State

In the logout state, the server simply terminates the connection.

The graphic below illustrates this progression through the four states.

IMAP4 Sample Dialog

The following demonstrates a typical dialog between a client downloading messages from a server using the IMAP protocol.

< connection >
Client: A0001 LOGIN username password
Server: A0001 OK LOGIN completed
Client: A0002 CREATE mailbox1
Server: A0002 OK CREATE completed
Client: A0003 SELECT mailbox1
Server: A0003 OK SELECT completed
< note: since this is a newly created mailbox, no mail exists >
Client: A0004 FETCH 1:3
Server: A0004 BAD FETCH
Client: A0005 Quit
Server: A0005 OK QUIT completed
< connection closed >

See Also

Brief History
SMTP Protocol
POP3 Protocol
Basic Message Structure
MIME Overview
SMIME Overview

Components
Imap
Pop
Smtp


Basic Message Structure

Basic Message Structure
See Also Send comments on this topic

Glossary Item Box

Email messages are comprised of an envelope and its contents. The envelope is rigidly structured and includes data needed for delivery, while the content is the less-structured package delivered to the recipient. When this standard was first proposed, the content was assumed to be text. Of course, the advent of multimedia made it necessary to send non-ASCII files as well. MIME (Multipurpose Internet Mail Extensions) was developed to make this possible. For simplicity, this topic will demonstrate with a message adhering to RFC 822 for transporting ASCII text-only messages. MIME is discussed in the MIME Overview page.

The Headers

The headers contain data pertaining to the content of the message. They are comprised of ASCII text lines consisting of a header field, a colon, and a header field value. There are two types of header fields: structured and unstructured. Structured header fields (such as From and Date) must follow a specific syntax so they can be parsed as needed. Unstructured header fields (such as Subject and Comments) are not required to follow a set syntax. Header fields are not required to be in any specific order, but they are required to appear before the message content.

The following are some commonly used email header fields:

Header Field | Description
Cc: | Carbon copy. It is a place to specify additional recipients.
Comments: | A nonstandard header used by some e-mail clients to specify more information about the sender.
Content-Description:* | Human-readable string describes the content of the message.
Content-Id:* | A unique MIME identifier that works in a similar fashion to Message-ID.
Content-Transfer-Encoding:* | Shows the MIME encoding used.
Content-Type:* | Tells MIME-compliant mail programs what type of data is in the cargo.
Date: | Specifies date the mail was sent.
Errors-To: | A place for mail generated errors.
From: | Specifies the user-defined sender of the mail.
Message-ID: | A unique identifier assigned to the message.
MIME-Version:* | Specifies the MIME version used by the sender.
Organization: | A free form header that usually contains the name of the organization.
Priority: | Assigns a priority to the message.
Received: | Provides a log of the message's history. This field is added to by every mail transport agent that relays the message.
Reply-To: | Specifies the reply address.
Return-Path: | Contains an address to send errors to during failed deliveries
Sender: | Authenticated identity of the agent that sent the message.
Subject: | Specifies the user-defined subject of the e-mail.
To: | The recipient of the e-mail.

* = These signify MIME headers which will be addressed in more detail in the MIME topic.

In addition to these fields, user-defined fields called extension fields or X-headers, may be added. These are added by the sending client and are only useful if the receiver's client has a method for handling them.

The Message Body

The body is the portion of the email the sender wishes the receiver to receive. It is merely the cargo and is usually made up of the actual text of the e-mail and/or any attachments.

In a simple text email message, both the body and the header are typically made up of 7-bit data, which is compatible with all mail servers, and are less than 1000 characters in line length.

A Basic Text Email

Here is an example composition of a basic text email.

To: test@email.com
Subject: email test
Message:

This is a test message to see the message form.

In this example, the sender simply opens their email client, specifies the receiver and the subject, writes a quick note and sends the mail. The sent message looks something like this:

Return-Path: <test@email.com>
Received: from YOURCOMPUTER ([192.168.0.0]) by yourserver.com
          (Post.Office MTA v3.5 release 215 ID# 0-
          54045U100L2S100V35)
          with ESMTP id com for <me@test.com>;
          Thu, 1 Feb 2001 16:46:38 -0500
To: test@email.com
From: me@test.com
Subject: email test
Message-ID: <0000c93a04003b07d1@[192.168.0.0]>
Date: Thu, 01 Feb 2001 16:47:39 -0500

This is a test message to see the message form.

The first 11 lines are the email headers. In this example, the only user-defined headers are the "From" header and the "Subject" header. The others were added by the email client and mail servers during the message's journey. Since no MIME headers are present in the message, the content is assumed to be ASCII text. To send a more sophisticated message (for example, one with attachments), MIME (Multipurpose Internet Mail Extensions) is required. MIME specifies how to format non-ASCII messages and is discussed in the MIME Overview.

See Also

Brief History
SMTP Protocol
POP3 Protocol
IMAP4 Protocol
MIME Overview
SMIME Overview

Components
Imap
Pop
Smtp


MIME Overview

MIME Overview
See Also Send comments on this topic

Glossary Item Box

Email messages can generally be separated into two broad categories:

  • Non-MIME messages
  • MIME messages

Although it is possible to create an email message combining elements which are both non-MIME and MIME, this is not recommended. PowerTCP Mail for .NET constructs only MIME messages from its object model.

Non-MIME Messages

A non-MIME message refers to any message that is created in the original format defined in RFC822. These messages are generally made up of simple text and Uuencoded or Yencoded attachments. Non-MIME messages can be fully decoded by PowerTCP Mail for .NET.

MIME Messages

MIME (Multipurpose Internet Mail Extensions) was defined to expand upon the original RFC822 message structure to provide a means for creating complex-multipart messages. MIME messages are usually recognizable by the "MIME-VERSION : 1.0" header line and the MIME-boundary separating the parts of the message.

Almost all email readers today are MIME compatible, so it is almost always desirable to create MIME messages. Create a non-MIME messages only if it is likely that the receiving mail reader is unable to read MIME.

The text-only format described by RFC 822 is extremely limiting. MIME allows an email message to contain data other than text, and still be backwardly-compatible with non-MIME compatible mail servers. When MIME was implemented, it caused some changes to the original message structure specified in RFC 822. Additional MIME-specific header fields were required to specify the MIME content. The structuring of the message body was changed to allow multiple types of files. Also, encoding rules were specified for non-ASCII attachments. Implementing MIME in this way allowed mail transfer agents to remain the same. Only the sending and receiving clients needed to be changed, in order to handle MIME attachments.

The message header fields added to the RFC 822 mail structure are:

  • MIME-Version (specifies the version of the MIME formatting, and distinguishes a message as being MIME structured)
  • Content-Description (provides additional information about the contents of the message)
  • Content-ID (provides message identification)
  • Content-Transfer-Encoding (indicates the type of encoding applied to the message part. Base64 and Quoted-Printable are the two most common forms of encoding that turn 8-bit data into 7-bit data)
  • Content-Type (describes the media type and subtype)

Of these headers, the two most pertinent to this discussion are the Content-Transfer-Encoding header field and the Content-Type header field.

Content-Type

Content-Type specifies the nature of the message body (the type of file). RFC 1521 defined seven types (which are still under revision):

  • Text (unformatted or formatted in a simple manner)
  • Image
  • Audio
  • Video
  • Application
  • Message (For example, an RFC 822 message)
  • Multipart (allows a message to contain more than one part)

This field dictates the content of the part so the client may handle it appropriately. Each type has a subtype which defines the specific format for the data. These fields demonstrate an ASCII text message sent with a MIME compliant user agent:

< RFC 822 header fields omitted >
Content-Transfer-Encoding: Quoted-Printable
Content-Type: text/plain; charset=ISO-8859-1
MIME-Version: 1.0
< message content (ASCII text omitted) >

This header indicates that MIME version 1.0 and Quoted-Printable encoding (more on this later) were used. The Content-Type type is "text" and the subtype is "plain," meaning that it is simple ASCII without other formatting applied.

As another example, these MIME header fields demonstrate a message containing only a single image:

< RFC 822 header fields omitted >
MIME-Version: 1.0
Content-Type: image/gif; name="Dart.GIF"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Dart.GIF"
< encoded message omitted >

Again the MIME-Version is 1.0, but the encoding used was Base64. The Content-Type is "image" and the subtype is "gif," indicating to the receiving user agent that the file "Dart.GIF" is indeed a "gif" type of image.

Content-Transfer-Encoding

The Content-Transfer-Encoding header field indicates the type of MIME-encoding used, so the receiving client can properly decode it using the same algorithm. Most file formats are 8-bit files in their natural state, but the SMTP protocol restricts messages to 7-bits. Encoding creates a 7-bit file from an 8-bit file, allowing compatibility with all SMTP agents.

RFC 2045 defines the use of two encoding algorithms, Quoted-Printable and Base64. There is no definable relationship between these algorithms and the Content-Type header field. In other words, the same file type is not always encoded with the same algorithm.

Quoted-Printable

An 8-bit character has 256 possible combinations (2^8). Of these, 128 (2^7) are printable ASCII characters (7-bit characters). These 7-bit characters are not a problem for transfer. To handle characters 128-256 (the characters represented by 8-bits), hexadecimal values are used. For example, a character with the value of 200 is encoded as "=C8".

Quoted-Printable encoded data is assumed to be line oriented. In fact, since ASCII characters are kept in their original form, often a file encoded with Quoted-Printable is highly readable. Using this encoding, lines are transmitted in lengths no longer than 76 characters. Here is an example:

<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
<html>
<!--(=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D)-->
<!--(Document created with RoboEditor. )=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D-->
<!--(=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D)-->
<head>
<title>Tutorial</title>

This document is apparently a portion of an HTML page, as some tags made up of ASCII characters have been preserved. There are quite a few encoded characters as well, clearly identifiable by the "=" preceding them.

Base64

Base64 encoding is entirely different from Quoted-Printable encoding. There is no attempt for the encoded data to be human-readable. Also, this form of encoding results in the encoded data being 33% larger than the original data. In base64, groups of 24-bits are separated. Natively, the data is represent in three "8-bit" segments. This data is encoded as four "6-bit" segments due to the 7-bit constraint. Here is an example:

pcEATSAJBAAA8BK/AAAAAAAAEAAAAAAABAAAnRsAAA4AYmpiauI94j0AAAAAAAAAAAAAAAAAAAAA
AAAJBBYAIjgAAIBXAACAVwAAnRcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//w8AAAAA
AAAAAAD//w8AAAAAAAAAAAD//w8AAAAAAAAAAAAAAAAAAAAAAGwAAAAAACABAAAAAAAAIAEAACAB
AAAAAAAAIAEAAAAAAAAgAQAAAAAAACABAAAAAAAAIAEAABQAAAAAAAAAAAAAADQBAAAAAAAAeAkA
AAAAAAB4CQAAAAAAAHgJAAAAAAAAeAkAAAwAAACECQAAJAAAADQBAAAAAAAAA1UAAGgBAAC0CQAA
AAAAALQJAAAAAAAAtAkAAAAAAAC0CQAAAAAAALQJAAAAAAAAtAkAAAAAAAC0CQAAAAAAALQJAAAA
AAAAglQAAAIAAACEVAAAAAAAAIRUAAAAAAAAhFQAAAAAAACEVAAAAAAAAIRUAAAAAAAAhFQAACQA
AABrVgAAIAIAAItYAAB8AAAAqFQAABUAAAAAAAAAAAAAAAAAAAAAAAAAIAEAAAAAAAC0CQAAAAAA

As expected, the structure of the data is completely changed making the result unreadable.

MIME With Multiple Parts

MIME allows the creation of messages with multiple parts. Possible parts include text parts, HTML parts and attachments. Parts can also be "multipart," allowing for nested parts. For example, if a file is attached to a message, the Content-Type in the main header becomes multipart, indicating that there are more parts than the message text. These parts are enumerated after the main header, separated by an automatically generated divider. Each of these parts may be encoded with a different encoding algorithm. The following demonstrates a message comprised of text, a gif file and a word doc.

The header is at the top of the message.

Return-Path: <test@test.com>
Received: from YOURCOMPUTER ([192.168.0.00]) by yourserver.com
          (Post.Office MTA v3.5 release 215 ID# 0-54045U100L2S100V35)
          with ESMTP id com for <test@email.com>;
          Fri, 2 Feb 2001 11:09:42 -0500
To: test@email.com
From: test@test.com
Subject: multipart email
MIME-Version: 1.0
Content-Type: multipart/mixed; Boundary="--PTCP_00011cb405020407d1"
Message-ID: <00011cb505020507d1@[192.168.0.71]>
Date: Fri, 02 Feb 2001 11:10:35 -0500

All fields from the original RFC 822 specification are present, but for this example, let's focus on the Content-Type. The type is described as multipart/mixed, which indicates there are several independent parts after the main header. The Boundary separates these parts; in this case with the character string, "--PTCP_00011cb405020407d1."

----PTCP_00011cb405020407d1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: Quoted-Printable
This message is a multipart MIME test.

----PTCP_00011cb405020407d1
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Dart.GIF"
Content-Type: application/octet-stream; name="Dart.GIF"
R0lGODlhbwAmAPf/AP///xAQECEhISkpKTExMTk5OUJCQkpKSlJSUlpaWmNjY2tra3Nzc3t7e4SE
hIyMjJSUlJycnKWlpa2trbW1tb29vcbGxs7OztbW1t7e3ufn5+/v7/f39+fe3tbGxrWcnGMxMVIA
< other Base64 encoding omitted >

----PTCP_00011cb405020407d1
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="dart site report.doc"
Content-Type: application/msword; name="dart site report.doc"
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAAKAAAAhwQAAAAAAAAA
EAAAiQQAAAEAAAD+////AAAAAH0EAAB+BAAAfwQAAIAEAACBBAAAggQAAIMEAACEBAAAhQQAAIYE
< other Base64 coding omitted >
----PTCP_00011cb405020407d1--

The three MIME parts are clearly exhibited, each delimited by the aforementioned Boundary string. The first part is the plain text message. It is encoded with Quoted-Printable, but is comprised of ASCII characters and is therefore intact: "This message is a multipart MIME test." The second part is the image "Dart.GIF." It is encoded with unreadable base64. The third part is the Microsoft Word document, "dart site report.doc." The message ends with a final Boundary string.

See Also

Brief History
SMTP Protocol
POP3 Protocol
IMAP4 Protocol
Basic Message Structure
SMIME Overview

Components
Imap
Pop
Smtp


SMIME Overview

SMIME Overview
See Also Send comments on this topic

Glossary Item Box

PowerTCP Mail for .NET can be used to sign and encrypt email messages using S/MIME.

S/MIME Message Signing

An outgoing message is signed using the sender's private key. The MailMessage uses a certificate, either provided by the caller or found in the system certificate store to obtain a private key to use in the message signing process. A mail agent that receives a signed message must have access to the sender's public key to verify the message signature. This public key is often included with a signed message, so the receipt of a signed message is the first step in sharing a public key.

Typically, signing certificates are found in the "CURRENT USER / MY" (a.k.a "Personal") store.

A signed message may be constructed in one of two ways: with a Detached signature method or a standard signing method.

The Detached signature method constructs the message and signature in a way that permits receiving agents to view the message, even if they are S/MIME unaware. A Detached signature message is a two-part MIME message. The first part contains the message in clear text, while the second part contains the message signature as a base64 encoded attachment.

On the other hand, a standard signed message consists of a single part MIME message. This part is a base64 encoded attachment containing both the ASN encoded message and the encoded message signature. This base64 encoding makes the message non-clear, and is why a detached signature message may be preferred over a standard signed message.

S/MIME Message Encryption

An outgoing message is encrypted using the recipient's public key. The MailMessage uses a certificate's public key (either provided by the caller or found in the system certificate store) to perform the message encryption. Only the owner of the recipient's private key can decrypt the message. Much like a standard signed message, an encrypted message is made up of a single part MIME attachment. The attachment is a base64 encoded part that contains the ASN encoded form of the message contents.

Typically, encrypting certificates are found in the "CURRENT USER / ADDRESSBOOK" (a.k.a "Other People") store.

S/MIME Certificates

Not every certificate can be used for S/MIME message encoding/decoding. The certificate must have an email address in the certificate's subject field. The MailMessage object (as well as receiving mail agents) matches a message's "From" email address with a certificate to be used when signing/verifying the message. Likewise, the email addresses contained in the "To" message header field are used to locate a certificate for S/MIME message encryption/decryption.

See Also

Brief History
SMTP Protocol
POP3 Protocol
IMAP4 Protocol
Basic Message Structure
MIME Overview

Components
Imap
Pop
Smtp


Dart.Mail Namespace

Dart.Mail Namespace
See Also Inheritance Hierarchy Send comments on this topic

Glossary Item Box

Classes

 | Class | Description
Class | Attachment | A MIME part that has a "Content-Disposition: attachment" header label. Supports non-MIME uu-encoded attachments. Content represents the file on disk.
Class | AuthenticatedSession | Holds authentication configuration used by transport protocols.
Class | ClientSecurity | Holds the configuration used to establish an SSL client session.
Class | ComponentBase | Base class for PowerTCP Components.
Class | ContentDisposition | Provides decoding support missing from System.Net.Mime.ContentDisposition.
Class | ContentType | Provides decoding support missing from System.Net.Mime.ContentType.
Class | DartLicenseException | The base class for all Dart component license exceptions.
Class | Data | Encapsulates data read or written.
Class | DataEventArgs | Provides data for reporting events.
Class | DataException | Thrown when the expected data could not be read.
Class | DeliveryStatusNotification | Specifies the Delivery Status Notification (DSN) options to use when sending mail using SMTP.
Class | ErrorEventArgs | Provides data for the Error event.
Class | HeaderDictionary | Provides a Dictionary of HeaderField objects using the header field name as the lookup key. See HeaderKey for common header field names.
Class | HeaderField | Provides encoding, decoding, parsing and manipulation for mail header fields (lines in the mail header).
Class | HeaderKey | Provides header field name strings that are used to index into HeaderDictionary.
Class | Htmlpart | Specializes Textpart using "text/html" ContentType.
Class | Imap | Integrates Internet Message Access Protocol (IMAP4) functionality into any .NET application.
Class | ImapAlertEventArgs | Provides data for the Imap.Alert event.
Class | ImapMessage | Represents a message the IMAP server is managing.
Class | ImapProgressEventArgs | Provides data for Imap.Progress.
Class | ImapResponse | Represents a single line response from an IMAP server.
Class | ImapSearchParameter | Represents a search criteria for Mailbox.Search.
Class | ImapSession | Holds configuration specialized for Imap.
Class | ImapUpdateEventArgs | Provides data for Imap.Update.
Class | ImapUTF7 | Provides modified UTF-7 encoding for encoding/decoding Mailbox.Name.
Class | IPEndPoint | Allows user to specify a range of IPEndPoints for local binding. Also resolves hostnames and saves them for future use.
Class | MailBase | Base class used by Pop, Imap and Smtp.
Class | Mailbox | Represents a mailbox on the IMAP server.
Class | MailboxCollection | A List of Mailbox objects sorted by Mailbox.Name.
Class | MailMessage | PowerTCP object model of an RFC 822 email message.
Class | MailSecurity | Specializes ClientSecurity with configuration properties used by Mail connections.
Class | MailSession | Holds configuration common to all email transport protocols.
Class | MessageBase | Abstract base class for server-side mail messages.
Class | Messagepart | A MIME part that has a "Content-Type: message/rfc822" header label and does not have "Content-Disposition: attachment" header label.
Class | Multipart | Implements base functionality for all multi-part mail parts.
Class | MultipartContent | Multi-part content (a List of parts) that follows the header.
Class | Part | Implements base functionality for all mail classes that have a header and a body.
Class | PartCollection<T> | Base class that implements a generic List that operates on Multipart.Parts.
Class | PipelineSendException | Thrown when a message fails to be sent using the SMTP Pipelining extension.
Class | Pop | Integrates Post Office Protocol version 3 (POP3) functionality into any .NET application, allowing applicationS to easily download Internet mail.
Class | PopMessage | Represents a message the POP server is managing.Represents a message the POP server is managing.
Class | PopMessageCollection | A List of PopMessage objects representing the mail messages on the POP server.
Class | PopProgressEventArgs | Provides data for Pop.Progress.
Class | ProgressEventArgs | Base class for PopProgressEventArgs, ImapProgressEventArgs and SmtpProgressEventArgs.
Class | ProtocolException | Thrown when an upper-layer protocol like FTP, SMTP or POP3 receives a negative response from the server.
Class | Proxy | Describes the server proxy, if any, to connect to.
Class | Recipient | Associates a recipient's System.Net.Mail.MailAddress with the response received from the server when the address was submitted.
Class | Resource | Implements base functionality for classes that have a header and a single part (not multi-part).
Class | Security | Holds the configuration used to establish an SSL session.
Class | Segment | Used to describe a byte[] segment that holds data.
Class | Session | Holds the configuration common to UDP and TCP.
Class | Smtp | Integrates Simple Mail Transfer Protocol (SMTP) functionality into any .NET application, allowing applications to easily send Internet mail.
Class | SmtpProgressEventArgs | Provides data for Smtp.Progress.
Class | SmtpResult | Represents the results from an SMTP send operation.
Class | SmtpSession | Holds configuration specialized for Imap.
Class | SocketBase | Base class for PowerTCP Components.
Class | SocketOption | Contains socket options that may be set by TCP and UDP sockets. These options are automatically applied to the connection used.
Class | TcpBase | Base class for components utilizing protocols built upon the TCP protocol.
Class | TcpSession | Holds the configuration used by TCP.
Class | TcpSocketOption | Contains socket options that may be set by TCP sockets.
Class | Textpart | Implements a part used to encapsulate Unicode characters.
Class | UserStateEventArgs | Provides data for ComponentBase.UserState. Base class for EventArgs that have Message and UserState properties.

Delegates

 | Delegate | Description
Delegate | TcpAsyncCallback | References the method to invoke on an IO completion thread when the corresponding asynchronous operation completes.

Enumerations

 | Enumeration | Description
Enumeration | Authentication | Enumerates the values of MailSession.Authentication.
Enumeration | ConnectionState | Enumerates the possible values of the connection state.
Enumeration | DataDirection | Enumerates the direction of data flow.
Enumeration | DigestAlgorithm | Algorithms used to sign (hash) an S/MIME message.
Enumeration | Encrypt | Enumerates the techniques used to establish SSL connections.
Enumeration | EncryptingAlgorithm | Possible symmetric algorithms used to encrypt an S/MIME message.
Enumeration | ForwardFormat | The supported formats used for forwarding an existing message.
Enumeration | ImapCode | Represents IMAP response codes.
Enumeration | ImapCriterion | Details criterion for the IMAP SEARCH command.
Enumeration | ImapFlags | Represents IMAP flags.
Enumeration | ImapMessageInfo | Represents the section(s) of an IMAP message when partial messages are retrieved.
Enumeration | ImapStatus | Enumerates IMAP status codes.
Enumeration | PopMessageInfo | Enumerates the possible values of PopMessage.Info.
Enumeration | Priority | Possible values of MailMessage.Priority.
Enumeration | ProxyType | Enumerates the provided proxy support that can be used.
Enumeration | SecureEncoding | Possible S/MIME encoding exposed by the message (which may have multiple nested encodings). Only the exposed encoding is known.
Enumeration | TransferEncoding | Enumerates the transfer encoding algorithms used on part content.

See Also

Reference

Dart.Mail Assembly


Attachment Class

[image]
PowerTCP Mail for .NET
Attachment Class
Members Example See Also Send comments on this topic
Dart.Mail Namespace : Attachment Class

Glossary Item Box

A MIME part that has a "Content-Disposition: attachment" header label. Supports non-MIME uu-encoded attachments. Content represents the file on disk.

Object Model

Attachment ClassContentDisposition ClassContentType ClassHeaderDictionary ClassHeaderField Class

Syntax

Visual Basic (Declaration)
Public Class Attachment
   Inherits Resource
Visual Basic (Usage) Copy Code
Dim instance As Attachment
C#
public class Attachment : Resource
Managed Extensions for C++
public __gc class Attachment : public Resource
C++/CLI
public ref class Attachment : public Resource

Remarks

During decoding, an Attachment is created when ContentDisposition.DispositionType == "attachment" or ContentType.MediaType starts with "application". File content is written to a file using a name returned by Path.GetRandomFileName() and stored in Directory; Attachment.FileName returns its actual filename. Use Attachment.Content.MoveTo(string) to move the decoded file to a permanent location.

Decoded attachment files are not automatically deleted when the object goes out of scope; to easily delete the decoded attachments from disk, delete Attachment.Directory or use Dispose(). Attachment.Dispose(), MailMessage.Dispose() (and the Dispose method for other Part types that can contain subparts), Imap.Dispose(), and Pop.Dispose() will each delete the attachment files associated with the object; Imap.Dispose() and Pop.Dispose() will delete the attachments for all messages under Imap.Mailboxes or Pop.Messages, and will also delete Attachment.Directory. Attachments that have been moved or renamed after decoding will not be deleted by Dispose(). Note: Imap.Dispose() and Pop.Dispose() will abort any active connection; when connected to a server, Close() should be called before Dispose() to gracefully shutdown the application.

Attachments may be decoded to memory instead of to disk; before decoding, set DecodeToMemory to true. When encoding, use a constructor that includes a byte[] parameter.

Attachment.ContentDisposition.Inline defaults to false. Set to true to indicate that the attachment should be shown "inline".

Example

Demonstrates saving attachments to disk. This example demonstrates creating a text MailMessage and adding an attachment.
C# Copy Code
/// <summary>
/// Saves the email's attachments to the specified directory.
/// </summary>
/// <param name="message">MailMessage containing attachments to save.</param>
/// <param name="saveDirectory">Directory to save attachments to.</param>
private void SaveAttachments(MailMessage message, string saveDirectory)
{
    foreach (Attachment attached in message.Attachments)
    {
        string filePath = Path.Combine(saveDirectory, attached.FileName);
        if (!Attachment.DecodeToMemory)
        {
            //If the component is configured to decode attachments to disk (the default),
            //use the Content property that returns a FileInfo representing the file on disk,
            //and copy the file to the desired location.
            attached.Content.CopyTo(filePath);
        }
        else
        {
            //If the component is configured to decode attachments to memory, get the content
            //MemoryStream with GetContentStream(), and write its content to a file.
            using (FileStream fs = new FileStream(filePath, FileMode.CreateNew, FileAccess.Write))
                attached.GetContentStream().CopyTo(fs);
        }
    }
}
Visual Basic Copy Code
''' <summary>
''' Saves the email's attachments to the specified directory.
''' </summary>
''' <param name="message">MailMessage containing attachments to save.</param>
''' <param name="saveDirectory">Directory to save attachments to.</param>
Private Sub SaveAttachments(ByVal message As MailMessage, ByVal saveDirectory As String)
    For Each attached As Attachment In message.Attachments
        Dim filePath As String = Path.Combine(saveDirectory, attached.FileName)
        If Not Attachment.DecodeToMemory Then
            'If the component is configured to decode attachments to disk (the default),
            'use the Content property that returns a FileInfo representing the file on disk,
            'and copy the file to the desired location.
            attached.Content.CopyTo(filePath)
        Else
            'If the component is configured to decode attachments to memory, get the content
            'MemoryStream with GetContentStream(), and write its content to a file.
            Using fs As New FileStream(filePath, FileMode.CreateNew, FileAccess.Write)
                attached.GetContentStream().CopyTo(fs)
            End Using
        End If
    Next attached
End Sub
C# Copy Code
private MailMessage CreateMailMessageWithAttachment()
{
    MailMessage message = new MailMessage();
    message.To = "to@dart.com";
    message.From = "from@dart.com";
    message.Subject = "This is a simple message";
    message.Text = "Please see the attached file.";
    message.Attachments.Add(new Attachment("C:\\File\\myAttachment.jpg"));
    return message;
}
Visual Basic Copy Code
Private Function CreateMailMessageWithAttachment() As MailMessage
    Dim message As New MailMessage()
    message.To = "to@dart.com"
    message.From = "from@dart.com"
    message.Subject = "This is a simple message"
    message.Text = "Please see the attached file."
    message.Attachments.Add(New Attachment("C:\File\myAttachment.jpg"))
    Return message
End Function

Inheritance Hierarchy

System.Object
Dart.Mail.Part
Dart.Mail.Resource
Dart.Mail.Attachment

See Also

Reference

Attachment Members
Dart.Mail Namespace


Attachment Class Members

[image]
PowerTCP Mail for .NET
Attachment Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : Attachment Class

Glossary Item Box

The following tables list the members exposed by Attachment.

Public Constructors

 | Name | Description
Public Constructor | Attachment Constructor | Overloaded.
Top

Public Properties

 | Name | Description
Public Property | Content | A reference to the attached file. When DecodeToMemory is false, decoded attachments are stored in this file.
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part. (Inherited from Dart.Mail.Resource)
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part. (Inherited from Dart.Mail.Resource)
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
static (Shared in Visual Basic) | DecodeToMemory | Gets or sets a value that specifies if a MemoryStream should be used for storing decoded content instead of Content.
static (Shared in Visual Basic) | Directory | Designates the location to temporarily store decoded file attachments.
Public Property | FileName | Gets and sets ContentDisposition.FileName and ContentType.Name.
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part. (Inherited from Dart.Mail.Resource)
Top

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values. (Inherited from Dart.Mail.Resource)
Public Method | Clone | Overridden. Creates a deep copy of the Attachment part, but a shallow copy of its Content.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content. (Inherited from Dart.Mail.Resource)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Resource)
Public Method | GetContentStream | Overridden. Gets a FileStream or MemoryStream for reading or writing of content data.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType. (Inherited from Dart.Mail.Resource)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Attachment Class
Dart.Mail Namespace


Attachment Constructor

[image]
PowerTCP Mail for .NET
Attachment Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : Attachment Constructor

Glossary Item Box

Overload List

Overload | Description
Attachment Constructor(String) | Constructor used to create a new Attachment and associate it with an existing file.
Attachment Constructor(String,String) | Constructor used to create a new Attachment and associate it with an existing file.
Attachment Constructor(Byte[],String) | Constructor used to create a new Attachment in memory and initialize it with binary data.

See Also

Reference

Attachment Class
Attachment Members


Attachment Constructor(String)

[image]
PowerTCP Mail for .NET
Attachment Constructor(String)
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class > Attachment Constructor : Attachment Constructor(String)

filePath
Used to initialize Content.

Glossary Item Box

Constructor used to create a new Attachment and associate it with an existing file.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal filePath As String _
)
Visual Basic (Usage) Copy Code
Dim filePath As String

Dim instance As New Attachment(filePath)
C#
public Attachment(
   string filePath
)
Managed Extensions for C++
public: Attachment(
   string* filePath
)
C++/CLI
public:
Attachment(
   String^ filePath
)

Parameters

filePath
Used to initialize Content.

Remarks

ContentDisposition.FileName is set to the specified filePath without path information. ContentType.MediaType is set using GetMediaTypeFromExtension. TransferEncoding is set to TransferEncoding.Base64. Attachment.ContentDisposition.Inline is initialized to false. Attachment.ContentDisposition.Inline can be set to true if the attachment should be viewed "inline".

See Also

Reference

Attachment Class
Attachment Members
Overload List


Attachment Constructor(String,String)

[image]
PowerTCP Mail for .NET
Attachment Constructor(String,String)
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class > Attachment Constructor : Attachment Constructor(String,String)

filePath
Used to initialize Content.
fileName
Used to initialize ContentDisposition.FileName and ContentType.MediaType.

Glossary Item Box

Constructor used to create a new Attachment and associate it with an existing file.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal filePath As String, _
   ByVal fileName As String _
)
Visual Basic (Usage) Copy Code
Dim filePath As String
Dim fileName As String

Dim instance As New Attachment(filePath, fileName)
C#
public Attachment(
   string filePath,
   string fileName
)
Managed Extensions for C++
public: Attachment(
   string* filePath,
   string* fileName
)
C++/CLI
public:
Attachment(
   String^ filePath,
   String^ fileName
)

Parameters

filePath
Used to initialize Content.
fileName
Used to initialize ContentDisposition.FileName and ContentType.MediaType.

Remarks

ContentType.MediaType is set using GetMediaTypeFromExtension. TransferEncoding is set to TransferEncoding.Base64. Attachment.ContentDisposition.Inline is initialized to false. Attachment.ContentDisposition.Inline can be set to true if the attachment should be viewed "inline".

See Also

Reference

Attachment Class
Attachment Members
Overload List


Attachment Constructor(Byte[],String)

[image]
PowerTCP Mail for .NET
Attachment Constructor(Byte[],String)
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class > Attachment Constructor : Attachment Constructor(Byte[],String)

content
Data for subsequent encoding.
fileName
Used to initialize ContentDisposition.FileName and ContentType.MediaType.

Glossary Item Box

Constructor used to create a new Attachment in memory and initialize it with binary data.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal content() As Byte, _
   ByVal fileName As String _
)
Visual Basic (Usage) Copy Code
Dim content() As Byte
Dim fileName As String

Dim instance As New Attachment(content, fileName)
C#
public Attachment(
   byte[] content,
   string fileName
)
Managed Extensions for C++
public: Attachment(
   byte[]* content,
   string* fileName
)
C++/CLI
public:
Attachment(
   array<byte>^ content,
   String^ fileName
)

Parameters

content
Data for subsequent encoding.
fileName
Used to initialize ContentDisposition.FileName and ContentType.MediaType.

Remarks

ContentType.MediaType is set using GetMediaTypeFromExtension. TransferEncoding is set to TransferEncoding.Base64. Attachment.ContentDisposition.Inline is initialized to false. Attachment.ContentDisposition.Inline can be set to true if the attachment should be viewed "inline".

Data is accessible through GetContentStream

See Also

Reference

Attachment Class
Attachment Members
Overload List


Attachment Class Methods

[image]
PowerTCP Mail for .NET
Attachment Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Attachment Class

Glossary Item Box

For a list of all members of this type, see Attachment members.

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values. (Inherited from Dart.Mail.Resource)
Public Method | Clone | Overridden. Creates a deep copy of the Attachment part, but a shallow copy of its Content.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content. (Inherited from Dart.Mail.Resource)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Resource)
Public Method | GetContentStream | Overridden. Gets a FileStream or MemoryStream for reading or writing of content data.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType. (Inherited from Dart.Mail.Resource)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Attachment Class
Dart.Mail Namespace


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : Clone Method

Glossary Item Box

Creates a deep copy of the Attachment part, but a shallow copy of its Content.

Syntax

Visual Basic (Declaration)
Public Overrides Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As Attachment
Dim value As Object

value = instance.Clone()
C#
public override object Clone()
Managed Extensions for C++
public: Object* Clone(); override
C++/CLI
public:
Object^ Clone(); override

Return Value

An Attachment

Remarks

Note: Calling Dispose() on the original or cloned part will dispose of the data that the original and clone reference.

See Also

Reference

Attachment Class
Attachment Members


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : Dispose Method

Glossary Item Box

Releases all resources associated with the object.

Overload List

Overload | Description
Dispose(Boolean) | Releases all resources associated with the object.
Dispose() | Releases all resources associated with the object. (Inherited from Dart.Mail.Part)

See Also

Reference

Attachment Class
Attachment Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As Attachment
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method releases all resources, and deletes the attachment file if it was decoded from an email and not moved.

See Also

Reference

Attachment Class
Attachment Members
Overload List


GetContentStream Method

[image]
PowerTCP Mail for .NET
GetContentStream Method
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : GetContentStream Method

Glossary Item Box

Gets a FileStream or MemoryStream for reading or writing of content data.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetContentStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As Attachment
Dim value As Stream

value = instance.GetContentStream()
C#
public override Stream GetContentStream()
Managed Extensions for C++
public: Stream* GetContentStream(); override
C++/CLI
public:
Stream^ GetContentStream(); override

Remarks

Content or Resource.Content provide the source and destination of content data, based upon the value of DecodeToMemory.

If Content and Resource.Content are null, then decoding is assumed and a FileStream or MemoryStream is created for subsequent writing by the decoder, based upon the value of DecodeToMemory.

See Also

Reference

Attachment Class
Attachment Members


Attachment Class Properties

[image]
PowerTCP Mail for .NET
Attachment Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Attachment Class

Glossary Item Box

For a list of all members of this type, see Attachment members.

Public Properties

 | Name | Description
Public Property | Content | A reference to the attached file. When DecodeToMemory is false, decoded attachments are stored in this file.
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part. (Inherited from Dart.Mail.Resource)
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part. (Inherited from Dart.Mail.Resource)
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
static (Shared in Visual Basic) | DecodeToMemory | Gets or sets a value that specifies if a MemoryStream should be used for storing decoded content instead of Content.
static (Shared in Visual Basic) | Directory | Designates the location to temporarily store decoded file attachments.
Public Property | FileName | Gets and sets ContentDisposition.FileName and ContentType.Name.
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part. (Inherited from Dart.Mail.Resource)
Top

See Also

Reference

Attachment Class
Dart.Mail Namespace


Content Property

[image]
PowerTCP Mail for .NET
Content Property
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : Content Property

Glossary Item Box

A reference to the attached file. When DecodeToMemory is false, decoded attachments are stored in this file.

Syntax

Visual Basic (Declaration)
Public Shadows Property Content As FileInfo
Visual Basic (Usage) Copy Code
Dim instance As Attachment
Dim value As FileInfo

instance.Content = value

value = instance.Content
C#
public new FileInfo Content {get; set;}
Managed Extensions for C++
public: __property new FileInfo* get_Content();
public: __property new void set_Content(
   FileInfo* value
);
C++/CLI
public:
new property FileInfo^ Content {
   FileInfo^ get();
   void set (    FileInfo^ value);
}

Remarks

Must be null when decoding (writing to the Stream returned by Part.GetEncodingStream). DecodeToMemory can be set to true if in-memory storage is preferred over disk storage. Must be non-null to encode a file.

See Also

Reference

Attachment Class
Attachment Members


DecodeToMemory Property

[image]
PowerTCP Mail for .NET
DecodeToMemory Property
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : DecodeToMemory Property

Glossary Item Box

Gets or sets a value that specifies if a MemoryStream should be used for storing decoded content instead of Content.

Syntax

Visual Basic (Declaration)
Public Shared Property DecodeToMemory As Boolean
Visual Basic (Usage) Copy Code
Dim value As Boolean

Attachment.DecodeToMemory = value

value = Attachment.DecodeToMemory
C#
public static bool DecodeToMemory {get; set;}
Managed Extensions for C++
public: __property static bool get_DecodeToMemory();
public: __property static void set_DecodeToMemory(
   bool value
);
C++/CLI
public:
static property bool DecodeToMemory {
   bool get();
   void set (    bool value);
}

Remarks

When set to true, GetContentStream will return a MemoryStream that is used for storing content (Content will be null).

See Also

Reference

Attachment Class
Attachment Members


Directory Property

[image]
PowerTCP Mail for .NET
Directory Property
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : Directory Property

Glossary Item Box

Designates the location to temporarily store decoded file attachments.

Syntax

Visual Basic (Declaration)
Public Shared Property Directory As String
Visual Basic (Usage) Copy Code
Dim value As String

Attachment.Directory = value

value = Attachment.Directory
C#
public static string Directory {get; set;}
Managed Extensions for C++
public: __property static string* get_Directory();
public: __property static void set_Directory(
   string* value
);
C++/CLI
public:
static property String^ Directory {
   String^ get();
   void set (    String^ value);
}

Remarks

This property defaults to an "Attachments" subfolder in the application's working directory. In addition to deleting decoded attachment files, Imap.Dispose() and Pop.Dispose() will also delete the directory specified by this property.

See Also

Reference

Attachment Class
Attachment Members


FileName Property

[image]
PowerTCP Mail for .NET
FileName Property
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : FileName Property

Glossary Item Box

Gets and sets ContentDisposition.FileName and ContentType.Name.

Syntax

Visual Basic (Declaration)
Public Property FileName As String
Visual Basic (Usage) Copy Code
Dim instance As Attachment
Dim value As String

instance.FileName = value

value = instance.FileName
C#
public string FileName {get; set;}
Managed Extensions for C++
public: __property string* get_FileName();
public: __property void set_FileName(
   string* value
);
C++/CLI
public:
property String^ FileName {
   String^ get();
   void set (    String^ value);
}

Remarks

Returns ContentType.Name if ContentDisposition.FileName is null or empty.

See Also

Reference

Attachment Class
Attachment Members


Length Property

[image]
PowerTCP Mail for .NET
Length Property
See Also Send comments on this topic
Dart.Mail Namespace > Attachment Class : Length Property

Glossary Item Box

Returns the approximate Length of the encoded part.

Syntax

Visual Basic (Declaration)
Public Overrides ReadOnly Property Length As Long
Visual Basic (Usage) Copy Code
Dim instance As Attachment
Dim value As Long

value = instance.Length
C#
public override long Length {get;}
Managed Extensions for C++
public: __property long get_Length() override;
C++/CLI
public:
property int64 Length {
   int64 get() override;
}

See Also

Reference

Attachment Class
Attachment Members


AuthenticatedSession Class

[image]
PowerTCP Mail for .NET
AuthenticatedSession Class
Members See Also Send comments on this topic
Dart.Mail Namespace : AuthenticatedSession Class

Glossary Item Box

Holds authentication configuration used by transport protocols.

Object Model

AuthenticatedSession ClassIPEndPoint ClassProxy ClassIPEndPoint ClassClientSecurity Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class AuthenticatedSession
   Inherits TcpSession
Visual Basic (Usage) Copy Code
Dim instance As AuthenticatedSession
C#
[Serializable()]
public class AuthenticatedSession : TcpSession
Managed Extensions for C++
[Serializable()]
public __gc class AuthenticatedSession : public TcpSession
C++/CLI
[Serializable()]
public ref class AuthenticatedSession : public TcpSession

Inheritance Hierarchy

System.Object
Dart.Mail.Session
Dart.Mail.TcpSession
Dart.Mail.AuthenticatedSession
Dart.Mail.MailSession

See Also

Reference

AuthenticatedSession Members
Dart.Mail Namespace


AuthenticatedSession Class Members

[image]
PowerTCP Mail for .NET
AuthenticatedSession Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : AuthenticatedSession Class

Glossary Item Box

The following tables list the members exposed by AuthenticatedSession.

Public Constructors

 | Name | Description
Public Constructor | AuthenticatedSession Constructor | Default constructor.
Top

Public Properties

 | Name | Description
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out. (Inherited from Dart.Mail.TcpSession)
Public Property | Domain | Gets or sets the domain (used for GSSAPI and NTLM authentication only).
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Password | Gets or sets the password or OAuth access token used for login.
Public Property | Proxy | Defines the optional server proxy configuration. (Inherited from Dart.Mail.TcpSession)
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the client-side SSL options. See the ClientSecurity class for more information. (Inherited from Dart.Mail.TcpSession)
Public Property | ServicePrincipleName | Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only).
Public Property | Username | Gets or sets the username used for login.
Top

See Also

Reference

AuthenticatedSession Class
Dart.Mail Namespace


AuthenticatedSession Constructor

[image]
PowerTCP Mail for .NET
AuthenticatedSession Constructor
See Also Send comments on this topic
Dart.Mail Namespace > AuthenticatedSession Class : AuthenticatedSession Constructor

Glossary Item Box

Default constructor.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New AuthenticatedSession()
C#
public AuthenticatedSession()
Managed Extensions for C++
public: AuthenticatedSession();
C++/CLI
public:
AuthenticatedSession();

See Also

Reference

AuthenticatedSession Class
AuthenticatedSession Members


AuthenticatedSession Class Properties

[image]
PowerTCP Mail for .NET
AuthenticatedSession Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : AuthenticatedSession Class

Glossary Item Box

For a list of all members of this type, see AuthenticatedSession members.

Public Properties

 | Name | Description
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out. (Inherited from Dart.Mail.TcpSession)
Public Property | Domain | Gets or sets the domain (used for GSSAPI and NTLM authentication only).
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Password | Gets or sets the password or OAuth access token used for login.
Public Property | Proxy | Defines the optional server proxy configuration. (Inherited from Dart.Mail.TcpSession)
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the client-side SSL options. See the ClientSecurity class for more information. (Inherited from Dart.Mail.TcpSession)
Public Property | ServicePrincipleName | Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only).
Public Property | Username | Gets or sets the username used for login.
Top

See Also

Reference

AuthenticatedSession Class
Dart.Mail Namespace


Domain Property

[image]
PowerTCP Mail for .NET
Domain Property
See Also Send comments on this topic
Dart.Mail Namespace > AuthenticatedSession Class : Domain Property

Glossary Item Box

Gets or sets the domain (used for GSSAPI and NTLM authentication only).

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Domain As String
Visual Basic (Usage) Copy Code
Dim instance As AuthenticatedSession
Dim value As String

instance.Domain = value

value = instance.Domain
C#
[DefaultValue()]
public string Domain {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property string* get_Domain();
public: __property void set_Domain(
   string* value
);
C++/CLI
[DefaultValue()]
public:
property String^ Domain {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

AuthenticatedSession Class
AuthenticatedSession Members


Password Property

[image]
PowerTCP Mail for .NET
Password Property
See Also Send comments on this topic
Dart.Mail Namespace > AuthenticatedSession Class : Password Property

Glossary Item Box

Gets or sets the password or OAuth access token used for login.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Password As String
Visual Basic (Usage) Copy Code
Dim instance As AuthenticatedSession
Dim value As String

instance.Password = value

value = instance.Password
C#
[DefaultValue()]
public string Password {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property string* get_Password();
public: __property void set_Password(
   string* value
);
C++/CLI
[DefaultValue()]
public:
property String^ Password {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

AuthenticatedSession Class
AuthenticatedSession Members


ServicePrincipleName Property

[image]
PowerTCP Mail for .NET
ServicePrincipleName Property
See Also Send comments on this topic
Dart.Mail Namespace > AuthenticatedSession Class : ServicePrincipleName Property

Glossary Item Box

Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only).

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property ServicePrincipleName As String
Visual Basic (Usage) Copy Code
Dim instance As AuthenticatedSession
Dim value As String

instance.ServicePrincipleName = value

value = instance.ServicePrincipleName
C#
[DefaultValue()]
public string ServicePrincipleName {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property string* get_ServicePrincipleName();
public: __property void set_ServicePrincipleName(
   string* value
);
C++/CLI
[DefaultValue()]
public:
property String^ ServicePrincipleName {
   String^ get();
   void set (    String^ value);
}

Remarks

If not set, the default values of "IMAP/hostname", "POP/hostname" and "SMTP/hostname" are used, where Session.RemoteEndPoint provides the hostname.

This property is used for GSSAPI or NTLM authentication. It specifies the service and hostname where that service is provided. Use "setspn -L hostname" at the command prompt to find out what SPNs are available at the specified hostname.

When the current user is logged on as part of a domain and Username is null or empty, setting the ServicePrincipleName is sufficient to use the Microsoft "Single Sign On" feature (the client will be authenticated as the currently authenticated user).

If Username is not null or empty, then Username, Password and Domain will be used to authenticate to the server. Use this technique to access another user's account.

See Also

Reference

AuthenticatedSession Class
AuthenticatedSession Members


Username Property

[image]
PowerTCP Mail for .NET
Username Property
See Also Send comments on this topic
Dart.Mail Namespace > AuthenticatedSession Class : Username Property

Glossary Item Box

Gets or sets the username used for login.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Username As String
Visual Basic (Usage) Copy Code
Dim instance As AuthenticatedSession
Dim value As String

instance.Username = value

value = instance.Username
C#
[DefaultValue()]
public string Username {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property string* get_Username();
public: __property void set_Username(
   string* value
);
C++/CLI
[DefaultValue()]
public:
property String^ Username {
   String^ get();
   void set (    String^ value);
}

Remarks

Set to null or empty to use GSSAPI or NTLM "Single Sign On" feature.

See Also

Reference

AuthenticatedSession Class
AuthenticatedSession Members


ClientSecurity Class

[image]
PowerTCP Mail for .NET
ClientSecurity Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ClientSecurity Class

Glossary Item Box

Holds the configuration used to establish an SSL client session.

Object Model

ClientSecurity Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class ClientSecurity
   Inherits Security
Visual Basic (Usage) Copy Code
Dim instance As ClientSecurity
C#
[Serializable()]
public class ClientSecurity : Security
Managed Extensions for C++
[Serializable()]
public __gc class ClientSecurity : public Security
C++/CLI
[Serializable()]
public ref class ClientSecurity : public Security

Inheritance Hierarchy

System.Object
Dart.Mail.Security
Dart.Mail.ClientSecurity
Dart.Mail.MailSecurity

See Also

Reference

ClientSecurity Members
Dart.Mail Namespace


ClientSecurity Class Members

[image]
PowerTCP Mail for .NET
ClientSecurity Class Members
See Also Fields Properties Send comments on this topic
Dart.Mail Namespace : ClientSecurity Class

Glossary Item Box

The following tables list the members exposed by ClientSecurity.

Public Constructors

 | Name | Description
Public Constructor | ClientSecurity Constructor | The default constructor for ClientSecurity
Top

Public Fields

 | Name | Description
Public Field | SelectionCallback | The delegate that executes to permit selection of a cient certificate.
Public Field | ValidationCallback | The delegate that executes after the server provides its certificate to the client. (Inherited from Dart.Mail.Security)
Top

Public Properties

 | Name | Description
Public Property | Certificates | Gets or sets a collection of client certificates to use during authentication.
Public Property | CheckCertificateRevocation | Indicates whether the certificate revocation list is checked during authentication. (Inherited from Dart.Mail.Security)
Public Property | Protocols | Gets or sets the SSLProtocols available. (Inherited from Dart.Mail.Security)
Public Property | TargetHost | Gets or sets the remote host to be authenticated.
Top

See Also

Reference

ClientSecurity Class
Dart.Mail Namespace


ClientSecurity Constructor

[image]
PowerTCP Mail for .NET
ClientSecurity Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ClientSecurity Class : ClientSecurity Constructor

Glossary Item Box

The default constructor for ClientSecurity

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New ClientSecurity()
C#
public ClientSecurity()
Managed Extensions for C++
public: ClientSecurity();
C++/CLI
public:
ClientSecurity();

See Also

Reference

ClientSecurity Class
ClientSecurity Members


ClientSecurity Class Properties

[image]
PowerTCP Mail for .NET
ClientSecurity Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ClientSecurity Class

Glossary Item Box

For a list of all members of this type, see ClientSecurity members.

Public Properties

 | Name | Description
Public Property | Certificates | Gets or sets a collection of client certificates to use during authentication.
Public Property | CheckCertificateRevocation | Indicates whether the certificate revocation list is checked during authentication. (Inherited from Dart.Mail.Security)
Public Property | Protocols | Gets or sets the SSLProtocols available. (Inherited from Dart.Mail.Security)
Public Property | TargetHost | Gets or sets the remote host to be authenticated.
Top

See Also

Reference

ClientSecurity Class
Dart.Mail Namespace


Certificates Property

[image]
PowerTCP Mail for .NET
Certificates Property
See Also Send comments on this topic
Dart.Mail Namespace > ClientSecurity Class : Certificates Property

Glossary Item Box

Gets or sets a collection of client certificates to use during authentication.

Syntax

Visual Basic (Declaration)
Public Property Certificates As X509CertificateCollection
Visual Basic (Usage) Copy Code
Dim instance As ClientSecurity
Dim value As X509CertificateCollection

instance.Certificates = value

value = instance.Certificates
C#
public X509CertificateCollection Certificates {get; set;}
Managed Extensions for C++
public: __property X509CertificateCollection* get_Certificates();
public: __property void set_Certificates(
   X509CertificateCollection* value
);
C++/CLI
public:
property X509CertificateCollection^ Certificates {
   X509CertificateCollection^ get();
   void set (    X509CertificateCollection^ value);
}

Remarks

If SelectionCallback is not null, the certificate chosen in the delegate will supercede any certificate present in this collection.

The first certificate in this collection that passes Microsoft's validation checks will be used during authentication.

See Also

Reference

ClientSecurity Class
ClientSecurity Members


TargetHost Property

[image]
PowerTCP Mail for .NET
TargetHost Property
See Also Send comments on this topic
Dart.Mail Namespace > ClientSecurity Class : TargetHost Property

Glossary Item Box

Gets or sets the remote host to be authenticated.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property TargetHost As String
Visual Basic (Usage) Copy Code
Dim instance As ClientSecurity
Dim value As String

instance.TargetHost = value

value = instance.TargetHost
C#
[DefaultValue()]
public string TargetHost {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property string* get_TargetHost();
public: __property void set_TargetHost(
   string* value
);
C++/CLI
[DefaultValue()]
public:
property String^ TargetHost {
   String^ get();
   void set (    String^ value);
}

Remarks

Used internally as the first parameter for SslStream.AuthenticateAsClient(), it will typically match the common name of the server-side certificate. .NET also uses this value to maintain an internal cache of SSL sessions that can be re-used.

If left empty, the value of the configured RemoteEndPoint.HostNameOrAddress will be used for authentication.

See Also

Reference

ClientSecurity Class
ClientSecurity Members


ClientSecurity Class Fields

[image]
PowerTCP Mail for .NET
ClientSecurity Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : ClientSecurity Class

Glossary Item Box

For a list of all members of this type, see ClientSecurity members.

Public Fields

 | Name | Description
Public Field | SelectionCallback | The delegate that executes to permit selection of a cient certificate.
Public Field | ValidationCallback | The delegate that executes after the server provides its certificate to the client. (Inherited from Dart.Mail.Security)
Top

See Also

Reference

ClientSecurity Class
Dart.Mail Namespace


SelectionCallback Field

[image]
PowerTCP Mail for .NET
SelectionCallback Field
See Also Send comments on this topic
Dart.Mail Namespace > ClientSecurity Class : SelectionCallback Field

Glossary Item Box

The delegate that executes to permit selection of a cient certificate.

Syntax

Visual Basic (Declaration)
Public SelectionCallback As LocalCertificateSelectionCallback
Visual Basic (Usage) Copy Code
Dim instance As ClientSecurity
Dim value As LocalCertificateSelectionCallback

value = instance.SelectionCallback

instance.SelectionCallback = value
C#
public LocalCertificateSelectionCallback SelectionCallback
Managed Extensions for C++
public: LocalCertificateSelectionCallback* SelectionCallback
C++/CLI
public:
LocalCertificateSelectionCallback^ SelectionCallback

Remarks

If null, the Certificates collection will be examined for a valid certifiate.

The certificate returned in this delegate will supercede any certificate present in the Certificates collection.

See Also

Reference

ClientSecurity Class
ClientSecurity Members


ComponentBase Class

[image]
PowerTCP Mail for .NET
ComponentBase Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ComponentBase Class

Glossary Item Box

Base class for PowerTCP Components.

Object Model

ComponentBase Class

Syntax

Visual Basic (Declaration)
Public Class ComponentBase
   Inherits System.ComponentModel.Component
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
C#
public class ComponentBase : System.ComponentModel.Component
Managed Extensions for C++
public __gc class ComponentBase : public System.ComponentModel.Component
C++/CLI
public ref class ComponentBase : public System.ComponentModel.Component

Inheritance Hierarchy

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.Mail.ComponentBase
Dart.Mail.MailBase
Dart.Mail.SocketBase

See Also

Reference

ComponentBase Members
Dart.Mail Namespace


ComponentBase Class Members

[image]
PowerTCP Mail for .NET
ComponentBase Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : ComponentBase Class

Glossary Item Box

The following tables list the members exposed by ComponentBase.

Public Properties

 | Name | Description
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Character encoding used by the component.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events).
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use.
Public Property | Tag | Gets or sets an object that stores any user data.
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

Public Methods

 | Name | Description
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. (Inherited from System.ComponentModel.Component)
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event.
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event.
Protected Method | OnUserState | Raises the UserState event.
Top

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start.
Public Event | UserState | Raised when Marshal(String,Object) is used.
Top

See Also

Reference

ComponentBase Class
Dart.Mail Namespace


ComponentBase Class Methods

[image]
PowerTCP Mail for .NET
ComponentBase Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ComponentBase Class

Glossary Item Box

For a list of all members of this type, see ComponentBase members.

Public Methods

 | Name | Description
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. (Inherited from System.ComponentModel.Component)
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event.
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event.
Protected Method | OnUserState | Raises the UserState event.
Top

See Also

Reference

ComponentBase Class
Dart.Mail Namespace


Marshal Method

[image]
PowerTCP Mail for .NET
Marshal Method
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : Marshal Method

Glossary Item Box

Marshals a string and/or object to the UI thread and raises the UserState event.

Overload List

Overload | Description
Marshal(String,Object) | Marshals a string and/or object to the UI thread and raises the UserState event.
Marshal(Exception) | Marshals an exception to the UI thread and raises the Error event.

See Also

Reference

ComponentBase Class
ComponentBase Members


Marshal(String,Object) Method

[image]
PowerTCP Mail for .NET
Marshal(String,Object) Method
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class > Marshal Method : Marshal(String,Object) Method

message
Message to pass into the UserState event.
state
Object to pass to the UserState event; can be null.

Glossary Item Box

Marshals a string and/or object to the UI thread and raises the UserState event.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Marshal( _
   ByVal message As String, _
   ByVal state As Object _
)
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim message As String
Dim state As Object

instance.Marshal(message, state)
C#
public void Marshal(
   string message,
   object state
)
Managed Extensions for C++
public: void Marshal(
   string* message,
   Object* state
)
C++/CLI
public:
void Marshal(
   String^ message,
   Object^ state
)

Parameters

message
Message to pass into the UserState event.
state
Object to pass to the UserState event; can be null.

Remarks

Used to marshal a string and/or object from a worker thread to the UI thread for typical display purposes. It calls OnUserState, which raises the UserState event.

See the SynchronizingObject property for information on updating UI controls in your event handler. Internally, SynchronizingObject.BeginInvoke is used to marshal data when the SynchronizingObject is not null, and Delegate.DynamicInvoke is used when SynchronizingObject is null. This method is provided for convenience; the developer may use alternative methods for marshaling data as required.

See Also

Reference

ComponentBase Class
ComponentBase Members
Overload List


Marshal(Exception) Method

[image]
PowerTCP Mail for .NET
Marshal(Exception) Method
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class > Marshal Method : Marshal(Exception) Method

exception
The Exception to be marshaled.

Glossary Item Box

Marshals an exception to the UI thread and raises the Error event.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Marshal( _
   ByVal exception As Exception _
)
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim exception As Exception

instance.Marshal(exception)
C#
public void Marshal(
   Exception exception
)
Managed Extensions for C++
public: void Marshal(
   Exception* exception
)
C++/CLI
public:
void Marshal(
   Exception^ exception
)

Parameters

exception
The Exception to be marshaled.

Remarks

Used to marshal exceptions from a worker thread to the UI thread for typical display purposes. It calls OnError, which raises the Error event.

When Start is used, unhandled exceptions generated on worker threads are marshaled to the UI thread by this method.

See the SynchronizingObject property for information on updating UI controls in your event handler. Internally, SynchronizingObject.BeginInvoke is used to marshal data when the SynchronizingObject is not null, and Delegate.DynamicInvoke is used when SynchronizingObject is null. This method is provided for convenience; the developer may use alternative methods for marshaling data as required.

See Also

Reference

ComponentBase Class
ComponentBase Members
Overload List


OnError Method

[image]
PowerTCP Mail for .NET
OnError Method
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : OnError Method

e
A ErrorEventArgs object that contains the exception.

Glossary Item Box

Raises the Error event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnError( _
   ByVal e As ErrorEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim e As ErrorEventArgs

instance.OnError(e)
C#
protected virtual void OnError(
   ErrorEventArgs e
)
Managed Extensions for C++
protected: virtual void OnError(
   ErrorEventArgs* e
)
C++/CLI
protected:
virtual void OnError(
   ErrorEventArgs^ e
)

Parameters

e
A ErrorEventArgs object that contains the exception.

Remarks

If the Synchronizing property is set, this method invokes Error asynchronously on the UI thread. If the Synchronizing property is null, this method invokes the Error event on the executing thread.

OnError allows derived classes to handle the Error event without attaching a delegate, but marshaling is not provided. This is the preferred technique for handling the event in a derived class.

Note to Inheritors: When overriding OnError in a derived class, be sure to call the base class OnError method, so that registered delegates receive the event.

See the SynchronizingObject property for information on updating UI controls in your event handler.

See Also

Reference

ComponentBase Class
ComponentBase Members


OnUserState Method

[image]
PowerTCP Mail for .NET
OnUserState Method
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : OnUserState Method

e
A UserStateEventArgs object that contains the user information.

Glossary Item Box

Raises the UserState event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnUserState( _
   ByVal e As UserStateEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim e As UserStateEventArgs

instance.OnUserState(e)
C#
protected virtual void OnUserState(
   UserStateEventArgs e
)
Managed Extensions for C++
protected: virtual void OnUserState(
   UserStateEventArgs* e
)
C++/CLI
protected:
virtual void OnUserState(
   UserStateEventArgs^ e
)

Parameters

e
A UserStateEventArgs object that contains the user information.

Remarks

If the Synchronizing property is set, this method invokes UserState asynchronously on the UI thread. If the Synchronizing property is null, this method invokes UserState on the executing thread.

OnUserState allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class, but marshaling is not provided.

Note to Inheritors: When overriding OnUserState in a derived class, be sure to call the base class OnUserState method, so that registered delegates receive the event.

See the SynchronizingObject property for information on updating UI controls in your event handler.

See Also

Reference

ComponentBase Class
ComponentBase Members


ComponentBase Class Properties

[image]
PowerTCP Mail for .NET
ComponentBase Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ComponentBase Class

Glossary Item Box

For a list of all members of this type, see ComponentBase members.

Public Properties

 | Name | Description
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Character encoding used by the component.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events).
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use.
Public Property | Tag | Gets or sets an object that stores any user data.
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

See Also

Reference

ComponentBase Class
Dart.Mail Namespace


Encoding Property

[image]
PowerTCP Mail for .NET
Encoding Property
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : Encoding Property

Glossary Item Box

Character encoding used by the component.

Syntax

Visual Basic (Declaration)
Public Overridable Property Encoding As Encoding
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim value As Encoding

instance.Encoding = value

value = instance.Encoding
C#
public virtual Encoding Encoding {get; set;}
Managed Extensions for C++
public: __property virtual Encoding* get_Encoding();
public: __property virtual void set_Encoding(
   Encoding* value
);
C++/CLI
public:
virtual property Encoding^ Encoding {
   Encoding^ get();
   void set (    Encoding^ value);
}

See Also

Reference

ComponentBase Class
ComponentBase Members


SynchronizingObject Property

[image]
PowerTCP Mail for .NET
SynchronizingObject Property
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : SynchronizingObject Property

Glossary Item Box

Gets or sets the object used to marshal data to the UI thread (for raising events).

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property SynchronizingObject As ISynchronizeInvoke
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim value As ISynchronizeInvoke

instance.SynchronizingObject = value

value = instance.SynchronizingObject
C#
[DefaultValue()]
public ISynchronizeInvoke SynchronizingObject {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property ISynchronizeInvoke* get_SynchronizingObject();
public: __property void set_SynchronizingObject(
   ISynchronizeInvoke* value
);
C++/CLI
[DefaultValue()]
public:
property ISynchronizeInvoke^ SynchronizingObject {
   ISynchronizeInvoke^ get();
   void set (    ISynchronizeInvoke^ value);
}

Remarks

This property determines the thread on which the component's event handlers are raised. If set to a UI control, events are raised on the UI thread. If null, events are raised on the current thread.

This property is automatically set to the containing control when used in the Windows Forms designer. When a derived class is dynamically created this property must be set if marshaling to the UI thread is desired.

See Also

Reference

ComponentBase Class
ComponentBase Members


SyncRoot Property

[image]
PowerTCP Mail for .NET
SyncRoot Property
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : SyncRoot Property

Glossary Item Box

Gets an object that is used to synchronize access to the upper layer protocol in use.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property SyncRoot As Object
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim value As Object

value = instance.SyncRoot
C#
public object SyncRoot {get;}
Managed Extensions for C++
public: __property Object* get_SyncRoot();
C++/CLI
public:
property Object^ SyncRoot {
   Object^ get();
}

Remarks

Upper layer protocols typically send a command and wait for it to complete. Use of this object in a C# "lock" statement can allow your code to wait until any ongoing command has completed.

See Also

Reference

ComponentBase Class
ComponentBase Members


Tag Property

[image]
PowerTCP Mail for .NET
Tag Property
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : Tag Property

Glossary Item Box

Gets or sets an object that stores any user data.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Tag As Object
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim value As Object

instance.Tag = value

value = instance.Tag
C#
[DefaultValue()]
public object Tag {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property Object* get_Tag();
public: __property void set_Tag(
   Object* value
);
C++/CLI
[DefaultValue()]
public:
property Object^ Tag {
   Object^ get();
   void set (    Object^ value);
}

See Also

Reference

ComponentBase Class
ComponentBase Members


ComponentBase Class Events

[image]
PowerTCP Mail for .NET
ComponentBase Class Events
See Also Send comments on this topic
Dart.Mail Namespace : ComponentBase Class

Glossary Item Box

For a list of all members of this type, see ComponentBase members.

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start.
Public Event | UserState | Raised when Marshal(String,Object) is used.
Top

See Also

Reference

ComponentBase Class
Dart.Mail Namespace


Error Event

[image]
PowerTCP Mail for .NET
Error Event
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : Error Event

Glossary Item Box

Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start.

Syntax

Visual Basic (Declaration)
Public Event Error As EventHandler(Of ErrorEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim handler As EventHandler(Of ErrorEventArgs)

AddHandler instance.Error, handler
C#
public event EventHandler<ErrorEventArgs> Error
Managed Extensions for C++
public: __event EventHandler<ErrorEventArgs*>* Error
C++/CLI
public:
event EventHandler<ErrorEventArgs^>^ Error

Remarks

See the SynchronizingObject property for information on updating UI controls in your event handler.

See Also

Reference

ComponentBase Class
ComponentBase Members


UserState Event

[image]
PowerTCP Mail for .NET
UserState Event
See Also Send comments on this topic
Dart.Mail Namespace > ComponentBase Class : UserState Event

Glossary Item Box

Raised when Marshal(String,Object) is used.

Syntax

Visual Basic (Declaration)
Public Event UserState As EventHandler(Of UserStateEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As ComponentBase
Dim handler As EventHandler(Of UserStateEventArgs)

AddHandler instance.UserState, handler
C#
public event EventHandler<UserStateEventArgs> UserState
Managed Extensions for C++
public: __event EventHandler<UserStateEventArgs*>* UserState
C++/CLI
public:
event EventHandler<UserStateEventArgs^>^ UserState

Event Data

The event handler receives an argument of type UserStateEventArgs containing data related to this event. The following UserStateEventArgs properties provide information specific to this event.

Property | Description
Message | Returns the message argument provided by the Marshal method.
UserState | Returns the user state argument provided by the Marshal method.

Remarks

See the SynchronizingObject property for information on updating UI controls in your event handler.

See Also

Reference

ComponentBase Class
ComponentBase Members


ContentDisposition Class

[image]
PowerTCP Mail for .NET
ContentDisposition Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ContentDisposition Class

Glossary Item Box

Provides decoding support missing from System.Net.Mime.ContentDisposition.

Object Model

ContentDisposition Class

Syntax

Visual Basic (Declaration)
Public Class ContentDisposition
   Inherits System.Net.Mime.ContentDisposition
Visual Basic (Usage) Copy Code
Dim instance As ContentDisposition
C#
public class ContentDisposition : System.Net.Mime.ContentDisposition
Managed Extensions for C++
public __gc class ContentDisposition : public System.Net.Mime.ContentDisposition
C++/CLI
public ref class ContentDisposition : public System.Net.Mime.ContentDisposition

Inheritance Hierarchy

System.Object
System.Net.Mime.ContentDisposition
Dart.Mail.ContentDisposition

See Also

Reference

ContentDisposition Members
Dart.Mail Namespace


ContentDisposition Class Members

[image]
PowerTCP Mail for .NET
ContentDisposition Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : ContentDisposition Class

Glossary Item Box

The following tables list the members exposed by ContentDisposition.

Public Constructors

 | Name | Description
Public Constructor | ContentDisposition Constructor | Overloaded.
Top

Public Properties

 | Name | Description
Public Property | CreationDate | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | DispositionType | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | FileName | Get or set the decoded FileName. Supports non-UTF8 encodings. When set, Encoding.UTF7 is used for encoding.
Public Property | Inline | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | ModificationDate | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | Parameters | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | ReadDate | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | Size | (Inherited from System.Net.Mime.ContentDisposition)
Top

Public Methods

 | Name | Description
Public Method | Clone | Creates a duplicate.
Public Method | Equals | (Inherited from System.Net.Mime.ContentDisposition)
Public Method | GetHashCode | (Inherited from System.Net.Mime.ContentDisposition)
Public Method | ToString | Provides the decoded "Content-Disposition" header field.
Top

See Also

Reference

ContentDisposition Class
Dart.Mail Namespace


ContentDisposition Constructor

[image]
PowerTCP Mail for .NET
ContentDisposition Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ContentDisposition Class : ContentDisposition Constructor

Glossary Item Box

Overload List

Overload | Description
ContentDisposition Constructor() | Default constructor.
ContentDisposition Constructor(String) | Initialization constructor.

See Also

Reference

ContentDisposition Class
ContentDisposition Members


ContentDisposition Constructor()

[image]
PowerTCP Mail for .NET
ContentDisposition Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > ContentDisposition Class > ContentDisposition Constructor : ContentDisposition Constructor()

Glossary Item Box

Default constructor.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New ContentDisposition()
C#
public ContentDisposition()
Managed Extensions for C++
public: ContentDisposition();
C++/CLI
public:
ContentDisposition();

See Also

Reference

ContentDisposition Class
ContentDisposition Members
Overload List


ContentDisposition Constructor(String)

[image]
PowerTCP Mail for .NET
ContentDisposition Constructor(String)
See Also Send comments on this topic
Dart.Mail Namespace > ContentDisposition Class > ContentDisposition Constructor : ContentDisposition Constructor(String)

body
The "Content-Disposition" body, which should be ASCII encoded.

Glossary Item Box

Initialization constructor.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal body As String _
)
Visual Basic (Usage) Copy Code
Dim body As String

Dim instance As New ContentDisposition(body)
C#
public ContentDisposition(
   string body
)
Managed Extensions for C++
public: ContentDisposition(
   string* body
)
C++/CLI
public:
ContentDisposition(
   String^ body
)

Parameters

body
The "Content-Disposition" body, which should be ASCII encoded.

See Also

Reference

ContentDisposition Class
ContentDisposition Members
Overload List


ContentDisposition Class Methods

[image]
PowerTCP Mail for .NET
ContentDisposition Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ContentDisposition Class

Glossary Item Box

For a list of all members of this type, see ContentDisposition members.

Public Methods

 | Name | Description
Public Method | Clone | Creates a duplicate.
Public Method | Equals | (Inherited from System.Net.Mime.ContentDisposition)
Public Method | GetHashCode | (Inherited from System.Net.Mime.ContentDisposition)
Public Method | ToString | Provides the decoded "Content-Disposition" header field.
Top

See Also

Reference

ContentDisposition Class
Dart.Mail Namespace


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > ContentDisposition Class : Clone Method

Glossary Item Box

Creates a duplicate.

Syntax

Visual Basic (Declaration)
Public Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As ContentDisposition
Dim value As Object

value = instance.Clone()
C#
public object Clone()
Managed Extensions for C++
public: Object* Clone();
C++/CLI
public:
Object^ Clone();

Return Value

ContentDisposition

See Also

Reference

ContentDisposition Class
ContentDisposition Members


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > ContentDisposition Class : ToString Method

Glossary Item Box

Provides the decoded "Content-Disposition" header field.

Syntax

Visual Basic (Declaration)
Public Overrides Function ToString() As String
Visual Basic (Usage) Copy Code
Dim instance As ContentDisposition
Dim value As String

value = instance.ToString()
C#
public override string ToString()
Managed Extensions for C++
public: string* ToString(); override
C++/CLI
public:
String^ ToString(); override

See Also

Reference

ContentDisposition Class
ContentDisposition Members


ContentDisposition Class Properties

[image]
PowerTCP Mail for .NET
ContentDisposition Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ContentDisposition Class

Glossary Item Box

For a list of all members of this type, see ContentDisposition members.

Public Properties

 | Name | Description
Public Property | CreationDate | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | DispositionType | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | FileName | Get or set the decoded FileName. Supports non-UTF8 encodings. When set, Encoding.UTF7 is used for encoding.
Public Property | Inline | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | ModificationDate | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | Parameters | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | ReadDate | (Inherited from System.Net.Mime.ContentDisposition)
Public Property | Size | (Inherited from System.Net.Mime.ContentDisposition)
Top

See Also

Reference

ContentDisposition Class
Dart.Mail Namespace


FileName Property

[image]
PowerTCP Mail for .NET
FileName Property
See Also Send comments on this topic
Dart.Mail Namespace > ContentDisposition Class : FileName Property

Glossary Item Box

Get or set the decoded FileName. Supports non-UTF8 encodings. When set, Encoding.UTF7 is used for encoding.

Syntax

Visual Basic (Declaration)
Public Shadows Property FileName As String
Visual Basic (Usage) Copy Code
Dim instance As ContentDisposition
Dim value As String

instance.FileName = value

value = instance.FileName
C#
public new string FileName {get; set;}
Managed Extensions for C++
public: __property new string* get_FileName();
public: __property new void set_FileName(
   string* value
);
C++/CLI
public:
new property String^ FileName {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

ContentDisposition Class
ContentDisposition Members


ContentType Class

[image]
PowerTCP Mail for .NET
ContentType Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ContentType Class

Glossary Item Box

Provides decoding support missing from System.Net.Mime.ContentType.

Object Model

ContentType Class

Syntax

Visual Basic (Declaration)
Public Class ContentType
   Inherits System.Net.Mime.ContentType
Visual Basic (Usage) Copy Code
Dim instance As ContentType
C#
public class ContentType : System.Net.Mime.ContentType
Managed Extensions for C++
public __gc class ContentType : public System.Net.Mime.ContentType
C++/CLI
public ref class ContentType : public System.Net.Mime.ContentType

Inheritance Hierarchy

System.Object
System.Net.Mime.ContentType
Dart.Mail.ContentType

See Also

Reference

ContentType Members
Dart.Mail Namespace


ContentType Class Members

[image]
PowerTCP Mail for .NET
ContentType Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : ContentType Class

Glossary Item Box

The following tables list the members exposed by ContentType.

Public Constructors

 | Name | Description
Public Constructor | ContentType Constructor | Overloaded.
Top

Public Properties

 | Name | Description
Public Property | Boundary | (Inherited from System.Net.Mime.ContentType)
Public Property | CharSet | Get the value of charset. Use Textpart.Encoding to set the charset for a Textpart or Htmlpart.
Public Property | MediaType | (Inherited from System.Net.Mime.ContentType)
Public Property | Name | Get or set the decoded Name. Supports non-UTF8 encodings. When set, Part.EncodingMap["default"] is used for encoding.
Public Property | Parameters | (Inherited from System.Net.Mime.ContentType)
Top

Public Methods

 | Name | Description
Public Method | Clone | Creates a duplicate.
Public Method | Equals | (Inherited from System.Net.Mime.ContentType)
Public Method | GetHashCode | (Inherited from System.Net.Mime.ContentType)
Public Method | ToString | Provides the decoded "Content-Type" header field.
Top

See Also

Reference

ContentType Class
Dart.Mail Namespace


ContentType Constructor

[image]
PowerTCP Mail for .NET
ContentType Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ContentType Class : ContentType Constructor

Glossary Item Box

Overload List

Overload | Description
ContentType Constructor() | Default constructor.
ContentType Constructor(String) | Initialization constructor.

See Also

Reference

ContentType Class
ContentType Members


ContentType Constructor()

[image]
PowerTCP Mail for .NET
ContentType Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > ContentType Class > ContentType Constructor : ContentType Constructor()

Glossary Item Box

Default constructor.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New ContentType()
C#
public ContentType()
Managed Extensions for C++
public: ContentType();
C++/CLI
public:
ContentType();

See Also

Reference

ContentType Class
ContentType Members
Overload List


ContentType Constructor(String)

[image]
PowerTCP Mail for .NET
ContentType Constructor(String)
See Also Send comments on this topic
Dart.Mail Namespace > ContentType Class > ContentType Constructor : ContentType Constructor(String)

body
The "Content-Type" body, which should be ASCII encoded.

Glossary Item Box

Initialization constructor.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal body As String _
)
Visual Basic (Usage) Copy Code
Dim body As String

Dim instance As New ContentType(body)
C#
public ContentType(
   string body
)
Managed Extensions for C++
public: ContentType(
   string* body
)
C++/CLI
public:
ContentType(
   String^ body
)

Parameters

body
The "Content-Type" body, which should be ASCII encoded.

See Also

Reference

ContentType Class
ContentType Members
Overload List


ContentType Class Methods

[image]
PowerTCP Mail for .NET
ContentType Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ContentType Class

Glossary Item Box

For a list of all members of this type, see ContentType members.

Public Methods

 | Name | Description
Public Method | Clone | Creates a duplicate.
Public Method | Equals | (Inherited from System.Net.Mime.ContentType)
Public Method | GetHashCode | (Inherited from System.Net.Mime.ContentType)
Public Method | ToString | Provides the decoded "Content-Type" header field.
Top

See Also

Reference

ContentType Class
Dart.Mail Namespace


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > ContentType Class : Clone Method

Glossary Item Box

Creates a duplicate.

Syntax

Visual Basic (Declaration)
Public Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As ContentType
Dim value As Object

value = instance.Clone()
C#
public object Clone()
Managed Extensions for C++
public: Object* Clone();
C++/CLI
public:
Object^ Clone();

Return Value

ContentType

See Also

Reference

ContentType Class
ContentType Members


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > ContentType Class : ToString Method

Glossary Item Box

Provides the decoded "Content-Type" header field.

Syntax

Visual Basic (Declaration)
Public Overrides Function ToString() As String
Visual Basic (Usage) Copy Code
Dim instance As ContentType
Dim value As String

value = instance.ToString()
C#
public override string ToString()
Managed Extensions for C++
public: string* ToString(); override
C++/CLI
public:
String^ ToString(); override

See Also

Reference

ContentType Class
ContentType Members


ContentType Class Properties

[image]
PowerTCP Mail for .NET
ContentType Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ContentType Class

Glossary Item Box

For a list of all members of this type, see ContentType members.

Public Properties

 | Name | Description
Public Property | Boundary | (Inherited from System.Net.Mime.ContentType)
Public Property | CharSet | Get the value of charset. Use Textpart.Encoding to set the charset for a Textpart or Htmlpart.
Public Property | MediaType | (Inherited from System.Net.Mime.ContentType)
Public Property | Name | Get or set the decoded Name. Supports non-UTF8 encodings. When set, Part.EncodingMap["default"] is used for encoding.
Public Property | Parameters | (Inherited from System.Net.Mime.ContentType)
Top

See Also

Reference

ContentType Class
Dart.Mail Namespace


CharSet Property

[image]
PowerTCP Mail for .NET
CharSet Property
See Also Send comments on this topic
Dart.Mail Namespace > ContentType Class : CharSet Property

Glossary Item Box

Get the value of charset. Use Textpart.Encoding to set the charset for a Textpart or Htmlpart.

Syntax

Visual Basic (Declaration)
Public Shadows ReadOnly Property CharSet As String
Visual Basic (Usage) Copy Code
Dim instance As ContentType
Dim value As String

value = instance.CharSet
C#
public new string CharSet {get;}
Managed Extensions for C++
public: __property new string* get_CharSet();
C++/CLI
public:
new property String^ CharSet {
   String^ get();
}

See Also

Reference

ContentType Class
ContentType Members


Name Property

[image]
PowerTCP Mail for .NET
Name Property
See Also Send comments on this topic
Dart.Mail Namespace > ContentType Class : Name Property

Glossary Item Box

Get or set the decoded Name. Supports non-UTF8 encodings. When set, Part.EncodingMap["default"] is used for encoding.

Syntax

Visual Basic (Declaration)
Public Shadows Property Name As String
Visual Basic (Usage) Copy Code
Dim instance As ContentType
Dim value As String

instance.Name = value

value = instance.Name
C#
public new string Name {get; set;}
Managed Extensions for C++
public: __property new string* get_Name();
public: __property new void set_Name(
   string* value
);
C++/CLI
public:
new property String^ Name {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

ContentType Class
ContentType Members


DartLicenseException Class

[image]
PowerTCP Mail for .NET
DartLicenseException Class
Members See Also Send comments on this topic
Dart.Mail Namespace : DartLicenseException Class

Glossary Item Box

The base class for all Dart component license exceptions.

Object Model

DartLicenseException Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class DartLicenseException
   Inherits System.Exception
Visual Basic (Usage) Copy Code
Dim instance As DartLicenseException
C#
[Serializable()]
public class DartLicenseException : System.Exception
Managed Extensions for C++
[Serializable()]
public __gc class DartLicenseException : public System.Exception
C++/CLI
[Serializable()]
public ref class DartLicenseException : public System.Exception

Remarks

Use the DartLicenseException class to catch runtime licensing exceptions. These exceptions are thrown at component creation time and during access of select properties or methods. The Message property will provide a description of the specific licensing problem encountered. The InnerException property should also be examined for additional details.

Inheritance Hierarchy

System.Object
System.Exception
Dart.Mail.DartLicenseException

See Also

Reference

DartLicenseException Members
Dart.Mail Namespace


DartLicenseException Class Members

[image]
PowerTCP Mail for .NET
DartLicenseException Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : DartLicenseException Class

Glossary Item Box

The following tables list the members exposed by DartLicenseException.

Public Properties

 | Name | Description
Public Property | Data | (Inherited from System.Exception)
Public Property | HelpLink | (Inherited from System.Exception)
Public Property | HResult | (Inherited from System.Exception)
Public Property | InnerException | (Inherited from System.Exception)
Public Property | Message | (Inherited from System.Exception)
Public Property | Source | (Inherited from System.Exception)
Public Property | StackTrace | (Inherited from System.Exception)
Public Property | TargetSite | (Inherited from System.Exception)
Top

Public Methods

 | Name | Description
Public Method | GetBaseException | (Inherited from System.Exception)
Public Method | GetObjectData | (Inherited from System.Exception)
Public Method | GetType | (Inherited from System.Exception)
Public Method | ToString | (Inherited from System.Exception)
Top

Protected Events

 | Name | Description
Protected Event | SerializeObjectState | (Inherited from System.Exception)
Top

See Also

Reference

DartLicenseException Class
Dart.Mail Namespace


Data Class

[image]
PowerTCP Mail for .NET
Data Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Data Class

Glossary Item Box

Encapsulates data read or written.

Object Model

Data Class

Syntax

Visual Basic (Declaration)
Public Class Data
   Inherits Segment
Visual Basic (Usage) Copy Code
Dim instance As Data
C#
public class Data : Segment
Managed Extensions for C++
public __gc class Data : public Segment
C++/CLI
public ref class Data : public Segment

Inheritance Hierarchy

System.Object
Dart.Mail.Segment
Dart.Mail.Data

See Also

Reference

Data Members
Dart.Mail Namespace


Data Class Members

[image]
PowerTCP Mail for .NET
Data Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : Data Class

Glossary Item Box

The following tables list the members exposed by Data.

Public Properties

 | Name | Description
Public Property | Buffer | Gets the buffer that holds data. (Inherited from Dart.Mail.Segment)
Public Property | Count | Byte count of data. (Inherited from Dart.Mail.Segment)
Public Property | Delimiter | Gets the delimiter byte array used by TcpBase.ReadToDelimiter.
Public Property | Direction | Indicates whether data is inbound or outbound.
Public Property | Encoding | Gets the character encoding used by the object.
Public Property | Offset | The offset into the buffer where the data starts. (Inherited from Dart.Mail.Segment)
Top

Public Methods

 | Name | Description
Public Method | ToString | Gets the data as a decoded string.
Top

See Also

Reference

Data Class
Dart.Mail Namespace


Data Class Methods

[image]
PowerTCP Mail for .NET
Data Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Data Class

Glossary Item Box

For a list of all members of this type, see Data members.

Public Methods

 | Name | Description
Public Method | ToString | Gets the data as a decoded string.
Top

See Also

Reference

Data Class
Dart.Mail Namespace


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > Data Class : ToString Method

Glossary Item Box

Gets the data as a decoded string.

Syntax

Visual Basic (Declaration)
Public Overrides Function ToString() As String
Visual Basic (Usage) Copy Code
Dim instance As Data
Dim value As String

value = instance.ToString()
C#
public override string ToString()
Managed Extensions for C++
public: string* ToString(); override
C++/CLI
public:
String^ ToString(); override

Return Value

The System.Buffer decoded into a string using Encoding.

See Also

Reference

Data Class
Data Members


Data Class Properties

[image]
PowerTCP Mail for .NET
Data Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Data Class

Glossary Item Box

For a list of all members of this type, see Data members.

Public Properties

 | Name | Description
Public Property | Buffer | Gets the buffer that holds data. (Inherited from Dart.Mail.Segment)
Public Property | Count | Byte count of data. (Inherited from Dart.Mail.Segment)
Public Property | Delimiter | Gets the delimiter byte array used by TcpBase.ReadToDelimiter.
Public Property | Direction | Indicates whether data is inbound or outbound.
Public Property | Encoding | Gets the character encoding used by the object.
Public Property | Offset | The offset into the buffer where the data starts. (Inherited from Dart.Mail.Segment)
Top

See Also

Reference

Data Class
Dart.Mail Namespace


Delimiter Property

[image]
PowerTCP Mail for .NET
Delimiter Property
See Also Send comments on this topic
Dart.Mail Namespace > Data Class : Delimiter Property

Glossary Item Box

Gets the delimiter byte array used by TcpBase.ReadToDelimiter.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Delimiter As Byte()
Visual Basic (Usage) Copy Code
Dim instance As Data
Dim value() As Byte

value = instance.Delimiter
C#
public byte[] Delimiter {get;}
Managed Extensions for C++
public: __property byte[]* get_Delimiter();
C++/CLI
public:
property array<byte>^ Delimiter {
   array<byte>^ get();
}

Property Value

Null if no delimiter was used or no delimiter was found. Otherwise, the delimiter byte array.

See Also

Reference

Data Class
Data Members


Direction Property

[image]
PowerTCP Mail for .NET
Direction Property
See Also Send comments on this topic
Dart.Mail Namespace > Data Class : Direction Property

Glossary Item Box

Indicates whether data is inbound or outbound.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Direction As DataDirection
Visual Basic (Usage) Copy Code
Dim instance As Data
Dim value As DataDirection

value = instance.Direction
C#
public DataDirection Direction {get;}
Managed Extensions for C++
public: __property DataDirection get_Direction();
C++/CLI
public:
property DataDirection Direction {
   DataDirection get();
}

See Also

Reference

Data Class
Data Members


Encoding Property

[image]
PowerTCP Mail for .NET
Encoding Property
See Also Send comments on this topic
Dart.Mail Namespace > Data Class : Encoding Property

Glossary Item Box

Gets the character encoding used by the object.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Encoding As Encoding
Visual Basic (Usage) Copy Code
Dim instance As Data
Dim value As Encoding

value = instance.Encoding
C#
public Encoding Encoding {get;}
Managed Extensions for C++
public: __property Encoding* get_Encoding();
C++/CLI
public:
property Encoding^ Encoding {
   Encoding^ get();
}

See Also

Reference

Data Class
Data Members


DataEventArgs Class

[image]
PowerTCP Mail for .NET
DataEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : DataEventArgs Class

Glossary Item Box

Provides data for reporting events.

Object Model

DataEventArgs ClassData Class

Syntax

Visual Basic (Declaration)
Public Class DataEventArgs
   Inherits UserStateEventArgs
Visual Basic (Usage) Copy Code
Dim instance As DataEventArgs
C#
public class DataEventArgs : UserStateEventArgs
Managed Extensions for C++
public __gc class DataEventArgs : public UserStateEventArgs
C++/CLI
public ref class DataEventArgs : public UserStateEventArgs

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.UserStateEventArgs
Dart.Mail.DataEventArgs

See Also

Reference

DataEventArgs Members
Dart.Mail Namespace


DataEventArgs Class Members

[image]
PowerTCP Mail for .NET
DataEventArgs Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : DataEventArgs Class

Glossary Item Box

The following tables list the members exposed by DataEventArgs.

Public Properties

 | Name | Description
Public Property | Data | Gets data provided by Data and Log events.
Public Property | Message | Returns the message argument provided by the Marshal method. (Inherited from Dart.Mail.UserStateEventArgs)
Public Property | UserState | Returns the user state argument provided by the Marshal method. (Inherited from Dart.Mail.UserStateEventArgs)
Top

Public Methods

 | Name | Description
Public Method | ToString | Gets the Data property as a decoded string.
Top

See Also

Reference

DataEventArgs Class
Dart.Mail Namespace


DataEventArgs Class Methods

[image]
PowerTCP Mail for .NET
DataEventArgs Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : DataEventArgs Class

Glossary Item Box

For a list of all members of this type, see DataEventArgs members.

Public Methods

 | Name | Description
Public Method | ToString | Gets the Data property as a decoded string.
Top

See Also

Reference

DataEventArgs Class
Dart.Mail Namespace


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > DataEventArgs Class : ToString Method

Glossary Item Box

Gets the Data property as a decoded string.

Syntax

Visual Basic (Declaration)
Public Overrides Function ToString() As String
Visual Basic (Usage) Copy Code
Dim instance As DataEventArgs
Dim value As String

value = instance.ToString()
C#
public override string ToString()
Managed Extensions for C++
public: string* ToString(); override
C++/CLI
public:
String^ ToString(); override

Return Value

The Data.Buffer decoded into a string using the Data.Encoding specified.

See Also

Reference

DataEventArgs Class
DataEventArgs Members


DataEventArgs Class Properties

[image]
PowerTCP Mail for .NET
DataEventArgs Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : DataEventArgs Class

Glossary Item Box

For a list of all members of this type, see DataEventArgs members.

Public Properties

 | Name | Description
Public Property | Data | Gets data provided by Data and Log events.
Public Property | Message | Returns the message argument provided by the Marshal method. (Inherited from Dart.Mail.UserStateEventArgs)
Public Property | UserState | Returns the user state argument provided by the Marshal method. (Inherited from Dart.Mail.UserStateEventArgs)
Top

See Also

Reference

DataEventArgs Class
Dart.Mail Namespace


Data Property

[image]
PowerTCP Mail for .NET
Data Property
See Also Send comments on this topic
Dart.Mail Namespace > DataEventArgs Class : Data Property

Glossary Item Box

Gets data provided by Data and Log events.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Data As Data
Visual Basic (Usage) Copy Code
Dim instance As DataEventArgs
Dim value As Data

value = instance.Data
C#
public Data Data {get;}
Managed Extensions for C++
public: __property Data* get_Data();
C++/CLI
public:
property Data^ Data {
   Data^ get();
}

See Also

Reference

DataEventArgs Class
DataEventArgs Members


DataException Class

[image]
PowerTCP Mail for .NET
DataException Class
Members See Also Send comments on this topic
Dart.Mail Namespace : DataException Class

Glossary Item Box

Thrown when the expected data could not be read.

Object Model

DataException Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class DataException
   Inherits System.ApplicationException
Visual Basic (Usage) Copy Code
Dim instance As DataException
C#
[Serializable()]
public class DataException : System.ApplicationException
Managed Extensions for C++
[Serializable()]
public __gc class DataException : public System.ApplicationException
C++/CLI
[Serializable()]
public ref class DataException : public System.ApplicationException

Inheritance Hierarchy

System.Object
System.Exception
System.ApplicationException
Dart.Mail.DataException

See Also

Reference

DataException Members
Dart.Mail Namespace


DataException Class Members

[image]
PowerTCP Mail for .NET
DataException Class Members
See Also Fields Properties Methods Events Send comments on this topic
Dart.Mail Namespace : DataException Class

Glossary Item Box

The following tables list the members exposed by DataException.

Public Fields

 | Name | Description
Public Field | DataRead | Data read from the socket before a failure generated this exception.
Top

Public Properties

 | Name | Description
Public Property | Data | (Inherited from System.Exception)
Public Property | HelpLink | (Inherited from System.Exception)
Public Property | HResult | (Inherited from System.Exception)
Public Property | InnerException | (Inherited from System.Exception)
Public Property | Message | (Inherited from System.Exception)
Public Property | Source | (Inherited from System.Exception)
Public Property | StackTrace | (Inherited from System.Exception)
Public Property | TargetSite | (Inherited from System.Exception)
Top

Public Methods

 | Name | Description
Public Method | GetBaseException | (Inherited from System.Exception)
Public Method | GetObjectData | (Inherited from System.Exception)
Public Method | GetType | (Inherited from System.Exception)
Public Method | ToString | (Inherited from System.Exception)
Top

Protected Events

 | Name | Description
Protected Event | SerializeObjectState | (Inherited from System.Exception)
Top

See Also

Reference

DataException Class
Dart.Mail Namespace


DataException Class Fields

[image]
PowerTCP Mail for .NET
DataException Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : DataException Class

Glossary Item Box

For a list of all members of this type, see DataException members.

Public Fields

 | Name | Description
Public Field | DataRead | Data read from the socket before a failure generated this exception.
Top

See Also

Reference

DataException Class
Dart.Mail Namespace


DataRead Field

[image]
PowerTCP Mail for .NET
DataRead Field
See Also Send comments on this topic
Dart.Mail Namespace > DataException Class : DataRead Field

Glossary Item Box

Data read from the socket before a failure generated this exception.

Syntax

Visual Basic (Declaration)
Public ReadOnly DataRead As Data
Visual Basic (Usage) Copy Code
Dim instance As DataException
Dim value As Data

value = instance.DataRead
C#
public readonly Data DataRead
Managed Extensions for C++
public: readonly Data* DataRead
C++/CLI
public:
readonly Data^ DataRead

See Also

Reference

DataException Class
DataException Members


DeliveryStatusNotification Class

[image]
PowerTCP Mail for .NET
DeliveryStatusNotification Class
Members Example See Also Send comments on this topic
Dart.Mail Namespace : DeliveryStatusNotification Class

Glossary Item Box

Specifies the Delivery Status Notification (DSN) options to use when sending mail using SMTP.

Object Model

DeliveryStatusNotification Class

Syntax

Visual Basic (Declaration)
Public Class DeliveryStatusNotification
Visual Basic (Usage) Copy Code
Dim instance As DeliveryStatusNotification
C#
public class DeliveryStatusNotification
Managed Extensions for C++
public __gc class DeliveryStatusNotification
C++/CLI
public ref class DeliveryStatusNotification

Remarks

Because in the original SMTP specification the support for notification of the success or failure of a sent message was quite limited, RFC 1891 defined an extension to the SMTP protocol to allow for Delivery Status Notification, or DSN. DSN allows much greater control over what conditions should the sender be notified and the construction of the notification itself. This was achieved by extending the SMTP RCPT and MAIL commands to allow the specification of notification parameters. These parameters include:

  • A NOTIFY parameter (appended to RCPT command) to specify under what conditions the sender should be notified (NEVER, SUCCESS, FAILURE, or DELAY).
  • A RET parameter (appended to MAIL command) to specify whether or not the message should be included in the DSN.
  • A ENVID parameter (appended to MAIL command) specifying an envelope identifier to be transmitted with the DSN.
  • A ORCPT parameter (appended to RCPT command) specifying the original recipient.

The properties of the DeliveryStatusNotification object control the use of these parameters:

  • Set DeliveryStatusNotification.Type to specify under what conditions a DSN should be sent (DSNType.Default, DSNType.Delay, DSNType.Failure, DSNType.Never, or DSNType.Success).
  • Set DeliveryStatusNotification.ReturnMessage to true to specify that the entire message should be included with the DSN, and false if only the header should be included.
  • Set DeliveryStatusNotification.EnvelopeID to the envelope identifier to be transmitted with the DSN.

Once the properties of the DeliveryStatusNotification object have been set, all DSN related communication will occur transparently. The ORCPT parameter is automatically added and set to the recipient.

Example

This example demonstrates sending a message with Delivery Status Notification (DSN).
C# Copy Code
using System.Net.Mail;

private void sendWithDsn()
{
    //Specify a DSN ID to use
    smtp1.DeliveryStatusNotification.EnvelopeID = "ID1234567";

    //Return the entire message instead of the headers
    smtp1.DeliveryStatusNotification.ReturnMessage = true;

    //Send a DSN on failure or delay
    smtp1.DeliveryStatusNotification.Options = DeliveryNotificationOptions.Delay | DeliveryNotificationOptions.OnFailure;

    //Send a message
    smtp1.Session.RemoteEndPoint = new IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;
    smtp1.Send(toAddress, fromAddress, "Test", "Test Message.");
    //Gracefully logout
    smtp1.Close();
}
Visual Basic Copy Code
Imports System.Net.Mail

Private Sub sendWithDsn()
    'Specify a DSN ID to use
    smtp1.DeliveryStatusNotification.EnvelopeID = "ID1234567"

    'Return the entire message instead of the headers
    smtp1.DeliveryStatusNotification.ReturnMessage = True

    'Send a DSN on failure or delay
    smtp1.DeliveryStatusNotification.Options = DeliveryNotificationOptions.Delay Or DeliveryNotificationOptions.OnFailure

    'Send a message
    smtp1.Session.RemoteEndPoint = New IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword
    smtp1.Send(toAddress, fromAddress, "Test", "Test Message.")
    'Gracefully logout
    smtp1.Close()
End Sub

Inheritance Hierarchy

System.Object
Dart.Mail.DeliveryStatusNotification

See Also

Reference

DeliveryStatusNotification Members
Dart.Mail Namespace


DeliveryStatusNotification Class Members

[image]
PowerTCP Mail for .NET
DeliveryStatusNotification Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : DeliveryStatusNotification Class

Glossary Item Box

The following tables list the members exposed by DeliveryStatusNotification.

Public Properties

 | Name | Description
Public Property | EnvelopeID | Specifies the envelope identifier to be transmitted with the message and returned with the DSN.
Public Property | Options | Enumerates what Delivery Status Notification will be sent.
Public Property | ReturnMessage | Specifies whether the entire message or only the header is returned with the DSN.
Top

See Also

Reference

DeliveryStatusNotification Class
Dart.Mail Namespace


DeliveryStatusNotification Class Properties

[image]
PowerTCP Mail for .NET
DeliveryStatusNotification Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : DeliveryStatusNotification Class

Glossary Item Box

For a list of all members of this type, see DeliveryStatusNotification members.

Public Properties

 | Name | Description
Public Property | EnvelopeID | Specifies the envelope identifier to be transmitted with the message and returned with the DSN.
Public Property | Options | Enumerates what Delivery Status Notification will be sent.
Public Property | ReturnMessage | Specifies whether the entire message or only the header is returned with the DSN.
Top

See Also

Reference

DeliveryStatusNotification Class
Dart.Mail Namespace


EnvelopeID Property

[image]
PowerTCP Mail for .NET
EnvelopeID Property
See Also Send comments on this topic
Dart.Mail Namespace > DeliveryStatusNotification Class : EnvelopeID Property

Glossary Item Box

Specifies the envelope identifier to be transmitted with the message and returned with the DSN.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property EnvelopeID As String
Visual Basic (Usage) Copy Code
Dim instance As DeliveryStatusNotification
Dim value As String

instance.EnvelopeID = value

value = instance.EnvelopeID
C#
[DefaultValue()]
public string EnvelopeID {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property string* get_EnvelopeID();
public: __property void set_EnvelopeID(
   string* value
);
C++/CLI
[DefaultValue()]
public:
property String^ EnvelopeID {
   String^ get();
   void set (    String^ value);
}

Property Value

A string value representing the envelope identifier to send with the message.

Remarks

When requesting a DSN, you can specify an identifier to track the status of a message. The value you specify as DeliveryStatusNotification.EnvelopeID, will be returned with the DSN in the "Original-Envelope-ID" header line. This value must be less than 100 characters.

See Also

Reference

DeliveryStatusNotification Class
DeliveryStatusNotification Members


Options Property

[image]
PowerTCP Mail for .NET
Options Property
See Also Send comments on this topic
Dart.Mail Namespace > DeliveryStatusNotification Class : Options Property

Glossary Item Box

Enumerates what Delivery Status Notification will be sent.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Options As DeliveryNotificationOptions
Visual Basic (Usage) Copy Code
Dim instance As DeliveryStatusNotification
Dim value As DeliveryNotificationOptions

instance.Options = value

value = instance.Options
C#
[DefaultValue()]
public DeliveryNotificationOptions Options {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property DeliveryNotificationOptions get_Options();
public: __property void set_Options(
   DeliveryNotificationOptions value
);
C++/CLI
[DefaultValue()]
public:
property DeliveryNotificationOptions Options {
   DeliveryNotificationOptions get();
   void set (    DeliveryNotificationOptions value);
}

Property Value

System.Net.Mail.DeliveryNotificationOptions.

Remarks

Set this property if you wish to have notification of the status of the delivery. The default value is System.Net.Mail.DeliveryNotificationOptions.None. Change this property if you would like to explicitly control DSN. For example, use System.Net.Mail.DeliveryNotificationOptions.OnFailure to request a DSN for a failed delivery.

See Also

Reference

DeliveryStatusNotification Class
DeliveryStatusNotification Members


ReturnMessage Property

[image]
PowerTCP Mail for .NET
ReturnMessage Property
See Also Send comments on this topic
Dart.Mail Namespace > DeliveryStatusNotification Class : ReturnMessage Property

Glossary Item Box

Specifies whether the entire message or only the header is returned with the DSN.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property ReturnMessage As Boolean
Visual Basic (Usage) Copy Code
Dim instance As DeliveryStatusNotification
Dim value As Boolean

instance.ReturnMessage = value

value = instance.ReturnMessage
C#
[DefaultValue()]
public bool ReturnMessage {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_ReturnMessage();
public: __property void set_ReturnMessage(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool ReturnMessage {
   bool get();
   void set (    bool value);
}

Property Value

true if the entire message is to be returned; otherwise false. The default value is false.

Remarks

The DeliveryStatusNotification.ReturnMessage property specifies whether or not the message should be included in any failed DSN issued for this message transmission. Set this property to true to receive the entire message with the DSN.

See Also

Reference

DeliveryStatusNotification Class
DeliveryStatusNotification Members


ErrorEventArgs Class

[image]
PowerTCP Mail for .NET
ErrorEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ErrorEventArgs Class

Glossary Item Box

Provides data for the Error event.

Object Model

ErrorEventArgs Class

Syntax

Visual Basic (Declaration)
Public Class ErrorEventArgs
   Inherits System.EventArgs
Visual Basic (Usage) Copy Code
Dim instance As ErrorEventArgs
C#
public class ErrorEventArgs : System.EventArgs
Managed Extensions for C++
public __gc class ErrorEventArgs : public System.EventArgs
C++/CLI
public ref class ErrorEventArgs : public System.EventArgs

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.ErrorEventArgs

See Also

Reference

ErrorEventArgs Members
Dart.Mail Namespace


ErrorEventArgs Class Members

[image]
PowerTCP Mail for .NET
ErrorEventArgs Class Members
See Also Methods Send comments on this topic
Dart.Mail Namespace : ErrorEventArgs Class

Glossary Item Box

The following tables list the members exposed by ErrorEventArgs.

Public Constructors

 | Name | Description
Public Constructor | ErrorEventArgs Constructor | Save an exception within this class.
Top

Public Methods

 | Name | Description
Public Method | GetException | Returns the Exception marshaled to the UI thread.
Top

See Also

Reference

ErrorEventArgs Class
Dart.Mail Namespace


ErrorEventArgs Constructor

[image]
PowerTCP Mail for .NET
ErrorEventArgs Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ErrorEventArgs Class : ErrorEventArgs Constructor

exception
Exception to save.

Glossary Item Box

Save an exception within this class.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal exception As Exception _
)
Visual Basic (Usage) Copy Code
Dim exception As Exception

Dim instance As New ErrorEventArgs(exception)
C#
public ErrorEventArgs(
   Exception exception
)
Managed Extensions for C++
public: ErrorEventArgs(
   Exception* exception
)
C++/CLI
public:
ErrorEventArgs(
   Exception^ exception
)

Parameters

exception
Exception to save.

See Also

Reference

ErrorEventArgs Class
ErrorEventArgs Members


ErrorEventArgs Class Methods

[image]
PowerTCP Mail for .NET
ErrorEventArgs Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ErrorEventArgs Class

Glossary Item Box

For a list of all members of this type, see ErrorEventArgs members.

Public Methods

 | Name | Description
Public Method | GetException | Returns the Exception marshaled to the UI thread.
Top

See Also

Reference

ErrorEventArgs Class
Dart.Mail Namespace


GetException Method

[image]
PowerTCP Mail for .NET
GetException Method
See Also Send comments on this topic
Dart.Mail Namespace > ErrorEventArgs Class : GetException Method

Glossary Item Box

Returns the Exception marshaled to the UI thread.

Syntax

Visual Basic (Declaration)
Public Function GetException() As Exception
Visual Basic (Usage) Copy Code
Dim instance As ErrorEventArgs
Dim value As Exception

value = instance.GetException()
C#
public Exception GetException()
Managed Extensions for C++
public: Exception* GetException();
C++/CLI
public:
Exception^ GetException();

Return Value

Exception

See Also

Reference

ErrorEventArgs Class
ErrorEventArgs Members


HeaderDictionary Class

[image]
PowerTCP Mail for .NET
HeaderDictionary Class
Members See Also Send comments on this topic
Dart.Mail Namespace : HeaderDictionary Class

Glossary Item Box

Provides a Dictionary of HeaderField objects using the header field name as the lookup key. See HeaderKey for common header field names.

Object Model

HeaderDictionary ClassHeaderField Class

Syntax

Visual Basic (Declaration)
Public Class HeaderDictionary
   Inherits System.Collections.Generic.Dictionary(Of String,HeaderField)
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
C#
public class HeaderDictionary : System.Collections.Generic.Dictionary<string,HeaderField>
Managed Extensions for C++
public __gc class HeaderDictionary : public System.Collections.Generic.Dictionary<string,HeaderField>
C++/CLI
public ref class HeaderDictionary : public System.Collections.Generic.Dictionary<String,HeaderField>

Inheritance Hierarchy

System.Object
System.Collections.Generic.Dictionary<TKey,TValue>
Dart.Mail.HeaderDictionary

See Also

Reference

HeaderDictionary Members
Dart.Mail Namespace


HeaderDictionary Class Members

[image]
PowerTCP Mail for .NET
HeaderDictionary Class Members
See Also Fields Properties Methods Send comments on this topic
Dart.Mail Namespace : HeaderDictionary Class

Glossary Item Box

The following tables list the members exposed by HeaderDictionary.

Public Fields

 | Name | Description
Public Field | Duplicates | A list of duplicate decoded header lines that were not included in the dictionary because their names were already used as a key.
Top

Public Properties

 | Name | Description
Public Property | Comparer | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Property | Count | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Property | Encoding | Gets or sets the encoding to use for encoded-word header encoding.
Public Property | Item | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Property | Keys | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Property | Length | The approximate length of the encoded header.
Public Property | Values | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Top

Public Methods

 | Name | Description
Public Method | Add | Overloaded. Adds a header field to the dictionary.
Public Method | Clear | Clears all properties and Dictionary entries.
Public Method | ContainsKey | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | ContainsValue | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | GetObjectData | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | GetValue | Shortcut method that returns an empty String if the specified header field name is not present.
Public Method | OnDeserialization | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | Remove | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | SetValue | Shortcut method that adds a new header field if the referenced field is not present.
Public Method | ToArray | Returns encoded MIME headers as a byte array. Includes trailing CR/LF (blank line).
Public Method | ToString | Overloaded. Returns MIME headers as a String. Does not included a trailing CR/LF (blank line).
Public Method | TryGetValue | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | Update | Updates the HeaderDictionary using current values of ContentType, ContentDisposition and MailMessage.Date.
Top

See Also

Reference

HeaderDictionary Class
Dart.Mail Namespace


HeaderDictionary Class Methods

[image]
PowerTCP Mail for .NET
HeaderDictionary Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : HeaderDictionary Class

Glossary Item Box

For a list of all members of this type, see HeaderDictionary members.

Public Methods

 | Name | Description
Public Method | Add | Overloaded. Adds a header field to the dictionary.
Public Method | Clear | Clears all properties and Dictionary entries.
Public Method | ContainsKey | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | ContainsValue | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | GetObjectData | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | GetValue | Shortcut method that returns an empty String if the specified header field name is not present.
Public Method | OnDeserialization | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | Remove | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | SetValue | Shortcut method that adds a new header field if the referenced field is not present.
Public Method | ToArray | Returns encoded MIME headers as a byte array. Includes trailing CR/LF (blank line).
Public Method | ToString | Overloaded. Returns MIME headers as a String. Does not included a trailing CR/LF (blank line).
Public Method | TryGetValue | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Method | Update | Updates the HeaderDictionary using current values of ContentType, ContentDisposition and MailMessage.Date.
Top

See Also

Reference

HeaderDictionary Class
Dart.Mail Namespace


Add Method

[image]
PowerTCP Mail for .NET
Add Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : Add Method

Glossary Item Box

Adds a header field to the dictionary.

Overload List

Overload | Description
Add(String,HeaderField) | Adds a header field to the dictionary.
Add(String) | Adds a new header field to the dictionary (uses the header label as the key).

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


Add(String,HeaderField) Method

[image]
PowerTCP Mail for .NET
Add(String,HeaderField) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class > Add Method : Add(String,HeaderField) Method

key
Header field name. Must equal Name.
value
Header field to add.

Glossary Item Box

Adds a header field to the dictionary.

Syntax

Visual Basic (Declaration)
Public Overloads Shadows Sub Add( _
   ByVal key As String, _
   ByVal value As HeaderField _
)
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim key As String
Dim value As HeaderField

instance.Add(key, value)
C#
public new void Add(
   string key,
   HeaderField value
)
Managed Extensions for C++
public: new void Add(
   string* key,
   HeaderField* value
)
C++/CLI
public:
new void Add(
   String^ key,
   HeaderField^ value
)

Parameters

key
Header field name. Must equal Name.
value
Header field to add.

Example

This example demonstrates how to add a custom header field to a message.
C# Copy Code
private MailMessage addCustomHeaderField(MailMessage message)
{
    //Add the following header to the message:
    //My-Custom-Header: This is a custom header
    message.Headers.Add("My-Custom-Header", new HeaderField("My-Custom-Header", "This is a custom header"));
    return message;
}
Visual Basic Copy Code
Private Function addCustomHeaderField(ByVal message As MailMessage) As MailMessage
    'Add the following header to the message:
    'My-Custom-Header: This is a custom header
    message.Headers.Add("My-Custom-Header", New HeaderField("My-Custom-Header", "This is a custom header"))
    Return message
End Function

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members
Overload List


Add(String) Method

[image]
PowerTCP Mail for .NET
Add(String) Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class > Add Method : Add(String) Method

headerLine
A header line in the format described in RFC 2822.

Glossary Item Box

Adds a new header field to the dictionary (uses the header label as the key).

Syntax

Visual Basic (Declaration)
Public Overloads Function Add( _
   ByVal headerLine As String _
) As HeaderField
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim headerLine As String
Dim value As HeaderField

value = instance.Add(headerLine)
C#
public HeaderField Add(
   string headerLine
)
Managed Extensions for C++
public: HeaderField* Add(
   string* headerLine
)
C++/CLI
public:
HeaderField^ Add(
   String^ headerLine
)

Parameters

headerLine
A header line in the format described in RFC 2822.

Return Value

A HeaderField if successful, or null if an exception was generated and added to DecodingExceptions.

Remarks

If the dictionary already contains an entry with the header label, the header field will be added to Duplicates

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members
Overload List


Clear Method

[image]
PowerTCP Mail for .NET
Clear Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : Clear Method

Glossary Item Box

Clears all properties and Dictionary entries.

Syntax

Visual Basic (Declaration)
Public Shadows Sub Clear()
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary

instance.Clear()
C#
public new void Clear()
Managed Extensions for C++
public: new void Clear();
C++/CLI
public:
new void Clear();

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


GetValue Method

[image]
PowerTCP Mail for .NET
GetValue Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : GetValue Method

name
Name of the header field that precedes the ':'. Typical values are available as string constants in HeaderKey.

Glossary Item Box

Shortcut method that returns an empty String if the specified header field name is not present.

Syntax

Visual Basic (Declaration)
Public Function GetValue( _
   ByVal name As String _
) As String
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim name As String
Dim value As String

value = instance.GetValue(name)
C#
public string GetValue(
   string name
)
Managed Extensions for C++
public: string* GetValue(
   string* name
)
C++/CLI
public:
String^ GetValue(
   String^ name
)

Parameters

name
Name of the header field that precedes the ':'. Typical values are available as string constants in HeaderKey.

Return Value

The value of the header field (parameters are not included).

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


SetValue Method

[image]
PowerTCP Mail for .NET
SetValue Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : SetValue Method

name
Name of the header field to reference. Typical values are available as string constants in HeaderKey.
value
New value. A null or empty string will remove the header field.

Glossary Item Box

Shortcut method that adds a new header field if the referenced field is not present.

Syntax

Visual Basic (Declaration)
Public Sub SetValue( _
   ByVal name As String, _
   ByVal value As String _
)
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim name As String
Dim value As String

instance.SetValue(name, value)
C#
public void SetValue(
   string name,
   string value
)
Managed Extensions for C++
public: void SetValue(
   string* name,
   string* value
)
C++/CLI
public:
void SetValue(
   String^ name,
   String^ value
)

Parameters

name
Name of the header field to reference. Typical values are available as string constants in HeaderKey.
value
New value. A null or empty string will remove the header field.

Remarks

Any existing parameters are preserved.

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


ToArray Method

[image]
PowerTCP Mail for .NET
ToArray Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : ToArray Method

Glossary Item Box

Returns encoded MIME headers as a byte array. Includes trailing CR/LF (blank line).

Syntax

Visual Basic (Declaration)
Public Function ToArray() As Byte()
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim value() As Byte

value = instance.ToArray()
C#
public byte[] ToArray()
Managed Extensions for C++
public: byte[]* ToArray();
C++/CLI
public:
array<byte>^ ToArray();

Return Value

byte[]

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : ToString Method

Glossary Item Box

Returns MIME headers as a String. Does not included a trailing CR/LF (blank line).

Overload List

Overload | Description
ToString(Boolean) | Returns MIME headers as a String. Does not included a trailing CR/LF (blank line).

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


ToString(Boolean) Method

[image]
PowerTCP Mail for .NET
ToString(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class > ToString Method : ToString(Boolean) Method

encode
If true, the ASCII-encoded representation is returned. Otherwise, the decoded UNICODE representation is returned.

Glossary Item Box

Returns MIME headers as a String. Does not included a trailing CR/LF (blank line).

Syntax

Visual Basic (Declaration)
Public Overloads Function ToString( _
   ByVal encode As Boolean _
) As String
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim encode As Boolean
Dim value As String

value = instance.ToString(encode)
C#
public string ToString(
   bool encode
)
Managed Extensions for C++
public: string* ToString(
   bool encode
)
C++/CLI
public:
String^ ToString(
   bool encode
)

Parameters

encode
If true, the ASCII-encoded representation is returned. Otherwise, the decoded UNICODE representation is returned.

Return Value

String

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members
Overload List


Update Method

[image]
PowerTCP Mail for .NET
Update Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : Update Method

Glossary Item Box

Updates the HeaderDictionary using current values of ContentType, ContentDisposition and MailMessage.Date.

Syntax

Visual Basic (Declaration)
Public Sub Update()
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary

instance.Update()
C#
public void Update()
Managed Extensions for C++
public: void Update();
C++/CLI
public:
void Update();

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


HeaderDictionary Class Properties

[image]
PowerTCP Mail for .NET
HeaderDictionary Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : HeaderDictionary Class

Glossary Item Box

For a list of all members of this type, see HeaderDictionary members.

Public Properties

 | Name | Description
Public Property | Comparer | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Property | Count | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Property | Encoding | Gets or sets the encoding to use for encoded-word header encoding.
Public Property | Item | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Property | Keys | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Public Property | Length | The approximate length of the encoded header.
Public Property | Values | (Inherited from System.Collections.Generic.Dictionary<string,HeaderField>)
Top

See Also

Reference

HeaderDictionary Class
Dart.Mail Namespace


Encoding Property

[image]
PowerTCP Mail for .NET
Encoding Property
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : Encoding Property

Glossary Item Box

Gets or sets the encoding to use for encoded-word header encoding.

Syntax

Visual Basic (Declaration)
Public Property Encoding As Encoding
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim value As Encoding

instance.Encoding = value

value = instance.Encoding
C#
public Encoding Encoding {get; set;}
Managed Extensions for C++
public: __property Encoding* get_Encoding();
public: __property void set_Encoding(
   Encoding* value
);
C++/CLI
public:
property Encoding^ Encoding {
   Encoding^ get();
   void set (    Encoding^ value);
}

Remarks

Defaults to UTF-8 outside Japan and Part.EncodingMap["default"] in Japan. System.Text.Encoding.Default can be used to maximize interoperability with non-Windows clients within a culture. System.Text.Encoding.UTF8 can be used to maximize interoperability across cultures. Encoded values are BASE64 encoded so they are safe for 7-bit transport.

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


Length Property

[image]
PowerTCP Mail for .NET
Length Property
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : Length Property

Glossary Item Box

The approximate length of the encoded header.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Length As Long
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim value As Long

value = instance.Length
C#
public long Length {get;}
Managed Extensions for C++
public: __property long get_Length();
C++/CLI
public:
property int64 Length {
   int64 get();
}

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


HeaderDictionary Class Fields

[image]
PowerTCP Mail for .NET
HeaderDictionary Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : HeaderDictionary Class

Glossary Item Box

For a list of all members of this type, see HeaderDictionary members.

Public Fields

 | Name | Description
Public Field | Duplicates | A list of duplicate decoded header lines that were not included in the dictionary because their names were already used as a key.
Top

See Also

Reference

HeaderDictionary Class
Dart.Mail Namespace


Duplicates Field

[image]
PowerTCP Mail for .NET
Duplicates Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderDictionary Class : Duplicates Field

Glossary Item Box

A list of duplicate decoded header lines that were not included in the dictionary because their names were already used as a key.

Syntax

Visual Basic (Declaration)
Public Duplicates As List(Of HeaderField)
Visual Basic (Usage) Copy Code
Dim instance As HeaderDictionary
Dim value As List(Of HeaderField)

value = instance.Duplicates

instance.Duplicates = value
C#
public List<HeaderField> Duplicates
Managed Extensions for C++
public: List<HeaderField*>* Duplicates
C++/CLI
public:
List<HeaderField^>^ Duplicates

Remarks

These values will be included is any subsequent encoding of the header.

See Also

Reference

HeaderDictionary Class
HeaderDictionary Members


HeaderField Class

[image]
PowerTCP Mail for .NET
HeaderField Class
Members See Also Send comments on this topic
Dart.Mail Namespace : HeaderField Class

Glossary Item Box

Provides encoding, decoding, parsing and manipulation for mail header fields (lines in the mail header).

Object Model

HeaderField Class

Syntax

Visual Basic (Declaration)
Public Class HeaderField
Visual Basic (Usage) Copy Code
Dim instance As HeaderField
C#
public class HeaderField
Managed Extensions for C++
public __gc class HeaderField
C++/CLI
public ref class HeaderField

Remarks

Header lines are "unfolded" to a single line and stored encoded as a HeaderField object, preserving original word encodings. Extended-parameter encoding is decoded (and not saved). String property values are decoded on the fly when referenced.

Inheritance Hierarchy

System.Object
Dart.Mail.HeaderField

See Also

Reference

HeaderField Members
Dart.Mail Namespace


HeaderField Class Members

[image]
PowerTCP Mail for .NET
HeaderField Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : HeaderField Class

Glossary Item Box

The following tables list the members exposed by HeaderField.

Public Constructors

 | Name | Description
Public Constructor | HeaderField Constructor | Initializes Name, Body, Value and Parameters.
Top

Public Properties

 | Name | Description
Public Property | Body | Gets or sets the decoded body of the header field (that follows ': ').
Public Property | Name | Gets the name that precedes the ':' in the header field line.
Public Property | Parameters | Gets the dictionary that contains the parameters included in the header represented by this instance.
Public Property | Value | Gets or sets the value following the ':' in the header field. Leading and trailing white space is trimmed. Parameters are not included. Returned values are decoded.
Top

Public Methods

 | Name | Description
Public Method | ToString | Returns the decoded header field constructed from Name, Value and Parameters properties.
Top

See Also

Reference

HeaderField Class
Dart.Mail Namespace


HeaderField Constructor

[image]
PowerTCP Mail for .NET
HeaderField Constructor
See Also Send comments on this topic
Dart.Mail Namespace > HeaderField Class : HeaderField Constructor

name
Assigned to Name.
body
Used to initialize Body, Value and Parameters.

Glossary Item Box

Initializes Name, Body, Value and Parameters.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal name As String, _
   ByVal body As String _
)
Visual Basic (Usage) Copy Code
Dim name As String
Dim body As String

Dim instance As New HeaderField(name, body)
C#
public HeaderField(
   string name,
   string body
)
Managed Extensions for C++
public: HeaderField(
   string* name,
   string* body
)
C++/CLI
public:
HeaderField(
   String^ name,
   String^ body
)

Parameters

name
Assigned to Name.
body
Used to initialize Body, Value and Parameters.

See Also

Reference

HeaderField Class
HeaderField Members


HeaderField Class Methods

[image]
PowerTCP Mail for .NET
HeaderField Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : HeaderField Class

Glossary Item Box

For a list of all members of this type, see HeaderField members.

Public Methods

 | Name | Description
Public Method | ToString | Returns the decoded header field constructed from Name, Value and Parameters properties.
Top

See Also

Reference

HeaderField Class
Dart.Mail Namespace


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > HeaderField Class : ToString Method

Glossary Item Box

Returns the decoded header field constructed from Name, Value and Parameters properties.

Syntax

Visual Basic (Declaration)
Public Overrides Function ToString() As String
Visual Basic (Usage) Copy Code
Dim instance As HeaderField
Dim value As String

value = instance.ToString()
C#
public override string ToString()
Managed Extensions for C++
public: string* ToString(); override
C++/CLI
public:
String^ ToString(); override

Return Value

System.String of the form "Label: Value...".

Remarks

The value of each parameter is quoted if it contains a special character as defined in RFC 822.

See Also

Reference

HeaderField Class
HeaderField Members


HeaderField Class Properties

[image]
PowerTCP Mail for .NET
HeaderField Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : HeaderField Class

Glossary Item Box

For a list of all members of this type, see HeaderField members.

Public Properties

 | Name | Description
Public Property | Body | Gets or sets the decoded body of the header field (that follows ': ').
Public Property | Name | Gets the name that precedes the ':' in the header field line.
Public Property | Parameters | Gets the dictionary that contains the parameters included in the header represented by this instance.
Public Property | Value | Gets or sets the value following the ':' in the header field. Leading and trailing white space is trimmed. Parameters are not included. Returned values are decoded.
Top

See Also

Reference

HeaderField Class
Dart.Mail Namespace


Body Property

[image]
PowerTCP Mail for .NET
Body Property
See Also Send comments on this topic
Dart.Mail Namespace > HeaderField Class : Body Property

Glossary Item Box

Gets or sets the decoded body of the header field (that follows ': ').

Syntax

Visual Basic (Declaration)
Public Property Body As String
Visual Basic (Usage) Copy Code
Dim instance As HeaderField
Dim value As String

instance.Body = value

value = instance.Body
C#
public string Body {get; set;}
Managed Extensions for C++
public: __property string* get_Body();
public: __property void set_Body(
   string* value
);
C++/CLI
public:
property String^ Body {
   String^ get();
   void set (    String^ value);
}

Property Value

Unicode string.

Remarks

When set, encoding is delayed until the message is encoded.

See Also

Reference

HeaderField Class
HeaderField Members


Name Property

[image]
PowerTCP Mail for .NET
Name Property
See Also Send comments on this topic
Dart.Mail Namespace > HeaderField Class : Name Property

Glossary Item Box

Gets the name that precedes the ':' in the header field line.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Name As String
Visual Basic (Usage) Copy Code
Dim instance As HeaderField
Dim value As String

value = instance.Name
C#
public string Name {get;}
Managed Extensions for C++
public: __property string* get_Name();
C++/CLI
public:
property String^ Name {
   String^ get();
}

See Also

Reference

HeaderField Class
HeaderField Members


Parameters Property

[image]
PowerTCP Mail for .NET
Parameters Property
See Also Send comments on this topic
Dart.Mail Namespace > HeaderField Class : Parameters Property

Glossary Item Box

Gets the dictionary that contains the parameters included in the header represented by this instance.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Parameters As Dictionary(Of String,String)
Visual Basic (Usage) Copy Code
Dim instance As HeaderField
Dim value As Dictionary(Of String,String)

value = instance.Parameters
C#
public Dictionary<string,string> Parameters {get;}
Managed Extensions for C++
public: __property Dictionary<string*,string*>* get_Parameters();
C++/CLI
public:
property Dictionary<String^,String^>^ Parameters {
   Dictionary<String^,String^>^ get();
}

Remarks

This dictionary contains the auxiliary name/value string pairs that may be present in the header.

See Also

Reference

HeaderField Class
HeaderField Members


Value Property

[image]
PowerTCP Mail for .NET
Value Property
See Also Send comments on this topic
Dart.Mail Namespace > HeaderField Class : Value Property

Glossary Item Box

Gets or sets the value following the ':' in the header field. Leading and trailing white space is trimmed. Parameters are not included. Returned values are decoded.

Syntax

Visual Basic (Declaration)
Public Property Value As String
Visual Basic (Usage) Copy Code
Dim instance As HeaderField
Dim value As String

instance.Value = value

value = instance.Value
C#
public string Value {get; set;}
Managed Extensions for C++
public: __property string* get_Value();
public: __property void set_Value(
   string* value
);
C++/CLI
public:
property String^ Value {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

HeaderField Class
HeaderField Members


HeaderKey Class

[image]
PowerTCP Mail for .NET
HeaderKey Class
Members See Also Send comments on this topic
Dart.Mail Namespace : HeaderKey Class

Glossary Item Box

Provides header field name strings that are used to index into HeaderDictionary.

Object Model

HeaderKey Class

Syntax

Visual Basic (Declaration)
Public Class HeaderKey
Visual Basic (Usage) Copy Code
Dim instance As HeaderKey
C#
public class HeaderKey
Managed Extensions for C++
public __gc class HeaderKey
C++/CLI
public ref class HeaderKey

Inheritance Hierarchy

System.Object
Dart.Mail.HeaderKey

See Also

Reference

HeaderKey Members
Dart.Mail Namespace


HeaderKey Class Members

[image]
PowerTCP Mail for .NET
HeaderKey Class Members
See Also Fields Send comments on this topic
Dart.Mail Namespace : HeaderKey Class

Glossary Item Box

The following tables list the members exposed by HeaderKey.

Public Constructors

 | Name | Description
Public Constructor | HeaderKey Constructor |
Top

Public Fields

 | Name | Description
Public Field | AcceptLanguage | "Accept-Language". Language(s) for auto-responses. RFC 4021.
Public Field | AutoSubmitted | "Auto-Submitted". Automatically submitted indicator. RFC 4021.
Public Field | Bcc | "bcc". Can be set in the header to indicate where "blind carbon copies" should be sent, but is not included in the encoded header.
Public Field | Cc | "Cc". Carbon-copy recipient mailbox(es). RFC 822, 1123.
Public Field | Comments | "Comments". Additional comments about the message. RFC 822.
Public Field | ContentDescription | "Content-Description". Description of a particular body part of a message. RFC 1521.
Public Field | ContentDisposition | "Content-Disposition". Whether a MIME body part is to beshown inline or is an attachment; can also indicate a suggested filename for use when saving an attachment to a file. RFC 1806.
Public Field | ContentId | "Content-ID". Unique ID of this message. RFC 1521.
Public Field | ContentLanguage | "Content-Language". RFC 1766.
Public Field | ContentMD5 | "Content-MD5". Checksum of content to ensure it has not been modified. RFC 1864.
Public Field | ContentTransferEncoding | "Content-Transfer-Encoding". Coding method used in a MIME message body. RFC 1521.
Public Field | ContentType | "Content-Type". Format of content. RFC 1049, 1123, 1521, 1766.
Public Field | Date | "Date". Date and time message was written. RFC 822, 1123, 1036.
Public Field | DeferredDelivery | "Deferred-Delivery". Deferred delivery information. RFC 4021.
Public Field | DeliveryReport | "Delivery-Report"
Public Field | DispositionNotificationOptions | "Disposition-Notification-Options". Disposition notification options. RFC 4021.
Public Field | DispositionNotificationTo | "Disposition-Notification-To". Mailbox for sending disposition notification. RFC 4021.
Public Field | Encrypted | "Encrypted". Message encryption information. RFC 4021.
Public Field | From | "From". Mailbox of message author. RFC 822, 1123, 1036.
Public Field | InReplyTo | "In-Reply-To." Reference to message which this message is a reply to. RFC 822.
Public Field | Keywords | "Keywords". Message key words for data base retrieval. RFC 822, 1036.
Public Field | LatestDeliveryTime | "Latest-Delivery-Time". Latest delivery timer requested. RFC 4021.
Public Field | ListArchive | "List-Archive". URL of mailing list archive. RFC 4021.
Public Field | ListHelp | "List-Help". URL for mailing list information. RFC 4021.
Public Field | ListID | "List-ID". Mailing list identifier. RFC 4021.
Public Field | ListOwner | "List-Owner". URL for mailing list owner's mailbox. RFC 4021.
Public Field | ListPost | "List-Post". URL for mailing list posting. RFC 4021.
Public Field | ListSubscribe | "List-Subscribe". URL for mailing list subscription. RFC 4021.
Public Field | ListUnsubscribe | "List-Unsubscribe". URL for mailing list unsubscription. RFC 4021.
Public Field | MessageContext | "Message-Context". Type or context of message. RFC 4021.
Public Field | MessageID | "Message-ID". Unique ID of this message. RFC 822, 1036.
Public Field | MimeVersion | "MIME-Version". An indicator that this message is formatted according to the MIME standard, and an indication of which version of MIME is utilized. RFC 1521.
Public Field | OriginalMessageID | "Original-Message-ID". Original message identifier. RFC 4021.
Public Field | OriginatorReturnAddress | "Originator-Return-Address". RFC 4021.
Public Field | Path | "Path"
Public Field | Priority | "Priority". Message priority. RFC 1327.
Public Field | Received | "Received". Trace of MTAs which a message has passed. RFC 822, 1123.
Public Field | References | "References". Related message identifier(s). RFC 822, 1036.
Public Field | ReplyTo | "Reply-To". RFC 822, 2822.
Public Field | ReturnPath | "Return-Path". Used to convey the information from the MAIL FROM envelope attribute in final delivery, when the message leaves the SMTP environment in which "MAIL FROM" is used. RFC 821, 1123.
Public Field | ReturnReceiptTo | "Return-Receipt-To".
Public Field | Sender | "Sender". The person or agent submitting the message to the network, if other than shown by the From: header. RFC 822, 1123.
Public Field | Status | "Status". A non-standard header field used by some servers to indicate the status of delivery for the message.
Public Field | Subject | "Subject". Topic of message. RFC 822, 1036.
Public Field | To | "To". Primary recipient mailbox(es). RFC 822, 1123.
Public Field | XPriority | "X-Priority". Message priority. RFC 4021.
Top

See Also

Reference

HeaderKey Class
Dart.Mail Namespace


HeaderKey Constructor

[image]
PowerTCP Mail for .NET
HeaderKey Constructor
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : HeaderKey Constructor

Glossary Item Box

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New HeaderKey()
C#
public HeaderKey()
Managed Extensions for C++
public: HeaderKey();
C++/CLI
public:
HeaderKey();

See Also

Reference

HeaderKey Class
HeaderKey Members


HeaderKey Class Fields

[image]
PowerTCP Mail for .NET
HeaderKey Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : HeaderKey Class

Glossary Item Box

For a list of all members of this type, see HeaderKey members.

Public Fields

 | Name | Description
Public Field | AcceptLanguage | "Accept-Language". Language(s) for auto-responses. RFC 4021.
Public Field | AutoSubmitted | "Auto-Submitted". Automatically submitted indicator. RFC 4021.
Public Field | Bcc | "bcc". Can be set in the header to indicate where "blind carbon copies" should be sent, but is not included in the encoded header.
Public Field | Cc | "Cc". Carbon-copy recipient mailbox(es). RFC 822, 1123.
Public Field | Comments | "Comments". Additional comments about the message. RFC 822.
Public Field | ContentDescription | "Content-Description". Description of a particular body part of a message. RFC 1521.
Public Field | ContentDisposition | "Content-Disposition". Whether a MIME body part is to beshown inline or is an attachment; can also indicate a suggested filename for use when saving an attachment to a file. RFC 1806.
Public Field | ContentId | "Content-ID". Unique ID of this message. RFC 1521.
Public Field | ContentLanguage | "Content-Language". RFC 1766.
Public Field | ContentMD5 | "Content-MD5". Checksum of content to ensure it has not been modified. RFC 1864.
Public Field | ContentTransferEncoding | "Content-Transfer-Encoding". Coding method used in a MIME message body. RFC 1521.
Public Field | ContentType | "Content-Type". Format of content. RFC 1049, 1123, 1521, 1766.
Public Field | Date | "Date". Date and time message was written. RFC 822, 1123, 1036.
Public Field | DeferredDelivery | "Deferred-Delivery". Deferred delivery information. RFC 4021.
Public Field | DeliveryReport | "Delivery-Report"
Public Field | DispositionNotificationOptions | "Disposition-Notification-Options". Disposition notification options. RFC 4021.
Public Field | DispositionNotificationTo | "Disposition-Notification-To". Mailbox for sending disposition notification. RFC 4021.
Public Field | Encrypted | "Encrypted". Message encryption information. RFC 4021.
Public Field | From | "From". Mailbox of message author. RFC 822, 1123, 1036.
Public Field | InReplyTo | "In-Reply-To." Reference to message which this message is a reply to. RFC 822.
Public Field | Keywords | "Keywords". Message key words for data base retrieval. RFC 822, 1036.
Public Field | LatestDeliveryTime | "Latest-Delivery-Time". Latest delivery timer requested. RFC 4021.
Public Field | ListArchive | "List-Archive". URL of mailing list archive. RFC 4021.
Public Field | ListHelp | "List-Help". URL for mailing list information. RFC 4021.
Public Field | ListID | "List-ID". Mailing list identifier. RFC 4021.
Public Field | ListOwner | "List-Owner". URL for mailing list owner's mailbox. RFC 4021.
Public Field | ListPost | "List-Post". URL for mailing list posting. RFC 4021.
Public Field | ListSubscribe | "List-Subscribe". URL for mailing list subscription. RFC 4021.
Public Field | ListUnsubscribe | "List-Unsubscribe". URL for mailing list unsubscription. RFC 4021.
Public Field | MessageContext | "Message-Context". Type or context of message. RFC 4021.
Public Field | MessageID | "Message-ID". Unique ID of this message. RFC 822, 1036.
Public Field | MimeVersion | "MIME-Version". An indicator that this message is formatted according to the MIME standard, and an indication of which version of MIME is utilized. RFC 1521.
Public Field | OriginalMessageID | "Original-Message-ID". Original message identifier. RFC 4021.
Public Field | OriginatorReturnAddress | "Originator-Return-Address". RFC 4021.
Public Field | Path | "Path"
Public Field | Priority | "Priority". Message priority. RFC 1327.
Public Field | Received | "Received". Trace of MTAs which a message has passed. RFC 822, 1123.
Public Field | References | "References". Related message identifier(s). RFC 822, 1036.
Public Field | ReplyTo | "Reply-To". RFC 822, 2822.
Public Field | ReturnPath | "Return-Path". Used to convey the information from the MAIL FROM envelope attribute in final delivery, when the message leaves the SMTP environment in which "MAIL FROM" is used. RFC 821, 1123.
Public Field | ReturnReceiptTo | "Return-Receipt-To".
Public Field | Sender | "Sender". The person or agent submitting the message to the network, if other than shown by the From: header. RFC 822, 1123.
Public Field | Status | "Status". A non-standard header field used by some servers to indicate the status of delivery for the message.
Public Field | Subject | "Subject". Topic of message. RFC 822, 1036.
Public Field | To | "To". Primary recipient mailbox(es). RFC 822, 1123.
Public Field | XPriority | "X-Priority". Message priority. RFC 4021.
Top

See Also

Reference

HeaderKey Class
Dart.Mail Namespace


AcceptLanguage Field

[image]
PowerTCP Mail for .NET
AcceptLanguage Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : AcceptLanguage Field

Glossary Item Box

"Accept-Language". Language(s) for auto-responses. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const AcceptLanguage As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.AcceptLanguage
C#
public const string AcceptLanguage
Managed Extensions for C++
public: const string* AcceptLanguage
C++/CLI
public:
const String^ AcceptLanguage

See Also

Reference

HeaderKey Class
HeaderKey Members


AutoSubmitted Field

[image]
PowerTCP Mail for .NET
AutoSubmitted Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : AutoSubmitted Field

Glossary Item Box

"Auto-Submitted". Automatically submitted indicator. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const AutoSubmitted As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.AutoSubmitted
C#
public const string AutoSubmitted
Managed Extensions for C++
public: const string* AutoSubmitted
C++/CLI
public:
const String^ AutoSubmitted

See Also

Reference

HeaderKey Class
HeaderKey Members


Bcc Field

[image]
PowerTCP Mail for .NET
Bcc Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Bcc Field

Glossary Item Box

"bcc". Can be set in the header to indicate where "blind carbon copies" should be sent, but is not included in the encoded header.

Syntax

Visual Basic (Declaration)
Public Const Bcc As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Bcc
C#
public const string Bcc
Managed Extensions for C++
public: const string* Bcc
C++/CLI
public:
const String^ Bcc

See Also

Reference

HeaderKey Class
HeaderKey Members


Cc Field

[image]
PowerTCP Mail for .NET
Cc Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Cc Field

Glossary Item Box

"Cc". Carbon-copy recipient mailbox(es). RFC 822, 1123.

Syntax

Visual Basic (Declaration)
Public Const Cc As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Cc
C#
public const string Cc
Managed Extensions for C++
public: const string* Cc
C++/CLI
public:
const String^ Cc

See Also

Reference

HeaderKey Class
HeaderKey Members


Comments Field

[image]
PowerTCP Mail for .NET
Comments Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Comments Field

Glossary Item Box

"Comments". Additional comments about the message. RFC 822.

Syntax

Visual Basic (Declaration)
Public Const Comments As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Comments
C#
public const string Comments
Managed Extensions for C++
public: const string* Comments
C++/CLI
public:
const String^ Comments

See Also

Reference

HeaderKey Class
HeaderKey Members


ContentDescription Field

[image]
PowerTCP Mail for .NET
ContentDescription Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ContentDescription Field

Glossary Item Box

"Content-Description". Description of a particular body part of a message. RFC 1521.

Syntax

Visual Basic (Declaration)
Public Const ContentDescription As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ContentDescription
C#
public const string ContentDescription
Managed Extensions for C++
public: const string* ContentDescription
C++/CLI
public:
const String^ ContentDescription

See Also

Reference

HeaderKey Class
HeaderKey Members


ContentDisposition Field

[image]
PowerTCP Mail for .NET
ContentDisposition Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ContentDisposition Field

Glossary Item Box

"Content-Disposition". Whether a MIME body part is to beshown inline or is an attachment; can also indicate a suggested filename for use when saving an attachment to a file. RFC 1806.

Syntax

Visual Basic (Declaration)
Public Const ContentDisposition As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ContentDisposition
C#
public const string ContentDisposition
Managed Extensions for C++
public: const string* ContentDisposition
C++/CLI
public:
const String^ ContentDisposition

See Also

Reference

HeaderKey Class
HeaderKey Members


ContentId Field

[image]
PowerTCP Mail for .NET
ContentId Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ContentId Field

Glossary Item Box

"Content-ID". Unique ID of this message. RFC 1521.

Syntax

Visual Basic (Declaration)
Public Const ContentId As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ContentId
C#
public const string ContentId
Managed Extensions for C++
public: const string* ContentId
C++/CLI
public:
const String^ ContentId

See Also

Reference

HeaderKey Class
HeaderKey Members


ContentLanguage Field

[image]
PowerTCP Mail for .NET
ContentLanguage Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ContentLanguage Field

Glossary Item Box

"Content-Language". RFC 1766.

Syntax

Visual Basic (Declaration)
Public Const ContentLanguage As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ContentLanguage
C#
public const string ContentLanguage
Managed Extensions for C++
public: const string* ContentLanguage
C++/CLI
public:
const String^ ContentLanguage

See Also

Reference

HeaderKey Class
HeaderKey Members


ContentMD5 Field

[image]
PowerTCP Mail for .NET
ContentMD5 Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ContentMD5 Field

Glossary Item Box

"Content-MD5". Checksum of content to ensure it has not been modified. RFC 1864.

Syntax

Visual Basic (Declaration)
Public Const ContentMD5 As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ContentMD5
C#
public const string ContentMD5
Managed Extensions for C++
public: const string* ContentMD5
C++/CLI
public:
const String^ ContentMD5

See Also

Reference

HeaderKey Class
HeaderKey Members


ContentTransferEncoding Field

[image]
PowerTCP Mail for .NET
ContentTransferEncoding Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ContentTransferEncoding Field

Glossary Item Box

"Content-Transfer-Encoding". Coding method used in a MIME message body. RFC 1521.

Syntax

Visual Basic (Declaration)
Public Const ContentTransferEncoding As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ContentTransferEncoding
C#
public const string ContentTransferEncoding
Managed Extensions for C++
public: const string* ContentTransferEncoding
C++/CLI
public:
const String^ ContentTransferEncoding

See Also

Reference

HeaderKey Class
HeaderKey Members


ContentType Field

[image]
PowerTCP Mail for .NET
ContentType Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ContentType Field

Glossary Item Box

"Content-Type". Format of content. RFC 1049, 1123, 1521, 1766.

Syntax

Visual Basic (Declaration)
Public Const ContentType As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ContentType
C#
public const string ContentType
Managed Extensions for C++
public: const string* ContentType
C++/CLI
public:
const String^ ContentType

See Also

Reference

HeaderKey Class
HeaderKey Members


Date Field

[image]
PowerTCP Mail for .NET
Date Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Date Field

Glossary Item Box

"Date". Date and time message was written. RFC 822, 1123, 1036.

Syntax

Visual Basic (Declaration)
Public Const Date As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Date
C#
public const string Date
Managed Extensions for C++
public: const string* Date
C++/CLI
public:
const String^ Date

See Also

Reference

HeaderKey Class
HeaderKey Members


DeferredDelivery Field

[image]
PowerTCP Mail for .NET
DeferredDelivery Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : DeferredDelivery Field

Glossary Item Box

"Deferred-Delivery". Deferred delivery information. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const DeferredDelivery As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.DeferredDelivery
C#
public const string DeferredDelivery
Managed Extensions for C++
public: const string* DeferredDelivery
C++/CLI
public:
const String^ DeferredDelivery

See Also

Reference

HeaderKey Class
HeaderKey Members


DeliveryReport Field

[image]
PowerTCP Mail for .NET
DeliveryReport Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : DeliveryReport Field

Glossary Item Box

"Delivery-Report"

Syntax

Visual Basic (Declaration)
Public Const DeliveryReport As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.DeliveryReport
C#
public const string DeliveryReport
Managed Extensions for C++
public: const string* DeliveryReport
C++/CLI
public:
const String^ DeliveryReport

See Also

Reference

HeaderKey Class
HeaderKey Members


DispositionNotificationOptions Field

[image]
PowerTCP Mail for .NET
DispositionNotificationOptions Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : DispositionNotificationOptions Field

Glossary Item Box

"Disposition-Notification-Options". Disposition notification options. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const DispositionNotificationOptions As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.DispositionNotificationOptions
C#
public const string DispositionNotificationOptions
Managed Extensions for C++
public: const string* DispositionNotificationOptions
C++/CLI
public:
const String^ DispositionNotificationOptions

See Also

Reference

HeaderKey Class
HeaderKey Members


DispositionNotificationTo Field

[image]
PowerTCP Mail for .NET
DispositionNotificationTo Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : DispositionNotificationTo Field

Glossary Item Box

"Disposition-Notification-To". Mailbox for sending disposition notification. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const DispositionNotificationTo As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.DispositionNotificationTo
C#
public const string DispositionNotificationTo
Managed Extensions for C++
public: const string* DispositionNotificationTo
C++/CLI
public:
const String^ DispositionNotificationTo

See Also

Reference

HeaderKey Class
HeaderKey Members


Encrypted Field

[image]
PowerTCP Mail for .NET
Encrypted Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Encrypted Field

Glossary Item Box

"Encrypted". Message encryption information. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const Encrypted As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Encrypted
C#
public const string Encrypted
Managed Extensions for C++
public: const string* Encrypted
C++/CLI
public:
const String^ Encrypted

See Also

Reference

HeaderKey Class
HeaderKey Members


From Field

[image]
PowerTCP Mail for .NET
From Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : From Field

Glossary Item Box

"From". Mailbox of message author. RFC 822, 1123, 1036.

Syntax

Visual Basic (Declaration)
Public Const From As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.From
C#
public const string From
Managed Extensions for C++
public: const string* From
C++/CLI
public:
const String^ From

See Also

Reference

HeaderKey Class
HeaderKey Members


InReplyTo Field

[image]
PowerTCP Mail for .NET
InReplyTo Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : InReplyTo Field

Glossary Item Box

"In-Reply-To." Reference to message which this message is a reply to. RFC 822.

Syntax

Visual Basic (Declaration)
Public Const InReplyTo As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.InReplyTo
C#
public const string InReplyTo
Managed Extensions for C++
public: const string* InReplyTo
C++/CLI
public:
const String^ InReplyTo

See Also

Reference

HeaderKey Class
HeaderKey Members


Keywords Field

[image]
PowerTCP Mail for .NET
Keywords Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Keywords Field

Glossary Item Box

"Keywords". Message key words for data base retrieval. RFC 822, 1036.

Syntax

Visual Basic (Declaration)
Public Const Keywords As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Keywords
C#
public const string Keywords
Managed Extensions for C++
public: const string* Keywords
C++/CLI
public:
const String^ Keywords

See Also

Reference

HeaderKey Class
HeaderKey Members


LatestDeliveryTime Field

[image]
PowerTCP Mail for .NET
LatestDeliveryTime Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : LatestDeliveryTime Field

Glossary Item Box

"Latest-Delivery-Time". Latest delivery timer requested. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const LatestDeliveryTime As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.LatestDeliveryTime
C#
public const string LatestDeliveryTime
Managed Extensions for C++
public: const string* LatestDeliveryTime
C++/CLI
public:
const String^ LatestDeliveryTime

See Also

Reference

HeaderKey Class
HeaderKey Members


ListArchive Field

[image]
PowerTCP Mail for .NET
ListArchive Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ListArchive Field

Glossary Item Box

"List-Archive". URL of mailing list archive. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const ListArchive As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ListArchive
C#
public const string ListArchive
Managed Extensions for C++
public: const string* ListArchive
C++/CLI
public:
const String^ ListArchive

See Also

Reference

HeaderKey Class
HeaderKey Members


ListHelp Field

[image]
PowerTCP Mail for .NET
ListHelp Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ListHelp Field

Glossary Item Box

"List-Help". URL for mailing list information. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const ListHelp As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ListHelp
C#
public const string ListHelp
Managed Extensions for C++
public: const string* ListHelp
C++/CLI
public:
const String^ ListHelp

See Also

Reference

HeaderKey Class
HeaderKey Members


ListID Field

[image]
PowerTCP Mail for .NET
ListID Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ListID Field

Glossary Item Box

"List-ID". Mailing list identifier. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const ListID As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ListID
C#
public const string ListID
Managed Extensions for C++
public: const string* ListID
C++/CLI
public:
const String^ ListID

See Also

Reference

HeaderKey Class
HeaderKey Members


ListOwner Field

[image]
PowerTCP Mail for .NET
ListOwner Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ListOwner Field

Glossary Item Box

"List-Owner". URL for mailing list owner's mailbox. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const ListOwner As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ListOwner
C#
public const string ListOwner
Managed Extensions for C++
public: const string* ListOwner
C++/CLI
public:
const String^ ListOwner

See Also

Reference

HeaderKey Class
HeaderKey Members


ListPost Field

[image]
PowerTCP Mail for .NET
ListPost Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ListPost Field

Glossary Item Box

"List-Post". URL for mailing list posting. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const ListPost As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ListPost
C#
public const string ListPost
Managed Extensions for C++
public: const string* ListPost
C++/CLI
public:
const String^ ListPost

See Also

Reference

HeaderKey Class
HeaderKey Members


ListSubscribe Field

[image]
PowerTCP Mail for .NET
ListSubscribe Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ListSubscribe Field

Glossary Item Box

"List-Subscribe". URL for mailing list subscription. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const ListSubscribe As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ListSubscribe
C#
public const string ListSubscribe
Managed Extensions for C++
public: const string* ListSubscribe
C++/CLI
public:
const String^ ListSubscribe

See Also

Reference

HeaderKey Class
HeaderKey Members


ListUnsubscribe Field

[image]
PowerTCP Mail for .NET
ListUnsubscribe Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ListUnsubscribe Field

Glossary Item Box

"List-Unsubscribe". URL for mailing list unsubscription. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const ListUnsubscribe As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ListUnsubscribe
C#
public const string ListUnsubscribe
Managed Extensions for C++
public: const string* ListUnsubscribe
C++/CLI
public:
const String^ ListUnsubscribe

See Also

Reference

HeaderKey Class
HeaderKey Members


MessageContext Field

[image]
PowerTCP Mail for .NET
MessageContext Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : MessageContext Field

Glossary Item Box

"Message-Context". Type or context of message. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const MessageContext As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.MessageContext
C#
public const string MessageContext
Managed Extensions for C++
public: const string* MessageContext
C++/CLI
public:
const String^ MessageContext

See Also

Reference

HeaderKey Class
HeaderKey Members


MessageID Field

[image]
PowerTCP Mail for .NET
MessageID Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : MessageID Field

Glossary Item Box

"Message-ID". Unique ID of this message. RFC 822, 1036.

Syntax

Visual Basic (Declaration)
Public Const MessageID As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.MessageID
C#
public const string MessageID
Managed Extensions for C++
public: const string* MessageID
C++/CLI
public:
const String^ MessageID

See Also

Reference

HeaderKey Class
HeaderKey Members


MimeVersion Field

[image]
PowerTCP Mail for .NET
MimeVersion Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : MimeVersion Field

Glossary Item Box

"MIME-Version". An indicator that this message is formatted according to the MIME standard, and an indication of which version of MIME is utilized. RFC 1521.

Syntax

Visual Basic (Declaration)
Public Const MimeVersion As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.MimeVersion
C#
public const string MimeVersion
Managed Extensions for C++
public: const string* MimeVersion
C++/CLI
public:
const String^ MimeVersion

See Also

Reference

HeaderKey Class
HeaderKey Members


OriginalMessageID Field

[image]
PowerTCP Mail for .NET
OriginalMessageID Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : OriginalMessageID Field

Glossary Item Box

"Original-Message-ID". Original message identifier. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const OriginalMessageID As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.OriginalMessageID
C#
public const string OriginalMessageID
Managed Extensions for C++
public: const string* OriginalMessageID
C++/CLI
public:
const String^ OriginalMessageID

See Also

Reference

HeaderKey Class
HeaderKey Members


OriginatorReturnAddress Field

[image]
PowerTCP Mail for .NET
OriginatorReturnAddress Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : OriginatorReturnAddress Field

Glossary Item Box

"Originator-Return-Address". RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const OriginatorReturnAddress As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.OriginatorReturnAddress
C#
public const string OriginatorReturnAddress
Managed Extensions for C++
public: const string* OriginatorReturnAddress
C++/CLI
public:
const String^ OriginatorReturnAddress

See Also

Reference

HeaderKey Class
HeaderKey Members


Path Field

[image]
PowerTCP Mail for .NET
Path Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Path Field

Glossary Item Box

"Path"

Syntax

Visual Basic (Declaration)
Public Const Path As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Path
C#
public const string Path
Managed Extensions for C++
public: const string* Path
C++/CLI
public:
const String^ Path

See Also

Reference

HeaderKey Class
HeaderKey Members


Priority Field

[image]
PowerTCP Mail for .NET
Priority Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Priority Field

Glossary Item Box

"Priority". Message priority. RFC 1327.

Syntax

Visual Basic (Declaration)
Public Const Priority As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Priority
C#
public const string Priority
Managed Extensions for C++
public: const string* Priority
C++/CLI
public:
const String^ Priority

See Also

Reference

HeaderKey Class
HeaderKey Members


Received Field

[image]
PowerTCP Mail for .NET
Received Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Received Field

Glossary Item Box

"Received". Trace of MTAs which a message has passed. RFC 822, 1123.

Syntax

Visual Basic (Declaration)
Public Const Received As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Received
C#
public const string Received
Managed Extensions for C++
public: const string* Received
C++/CLI
public:
const String^ Received

See Also

Reference

HeaderKey Class
HeaderKey Members


References Field

[image]
PowerTCP Mail for .NET
References Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : References Field

Glossary Item Box

"References". Related message identifier(s). RFC 822, 1036.

Syntax

Visual Basic (Declaration)
Public Const References As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.References
C#
public const string References
Managed Extensions for C++
public: const string* References
C++/CLI
public:
const String^ References

See Also

Reference

HeaderKey Class
HeaderKey Members


ReplyTo Field

[image]
PowerTCP Mail for .NET
ReplyTo Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ReplyTo Field

Glossary Item Box

"Reply-To". RFC 822, 2822.

Syntax

Visual Basic (Declaration)
Public Const ReplyTo As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ReplyTo
C#
public const string ReplyTo
Managed Extensions for C++
public: const string* ReplyTo
C++/CLI
public:
const String^ ReplyTo

See Also

Reference

HeaderKey Class
HeaderKey Members


ReturnPath Field

[image]
PowerTCP Mail for .NET
ReturnPath Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ReturnPath Field

Glossary Item Box

"Return-Path". Used to convey the information from the MAIL FROM envelope attribute in final delivery, when the message leaves the SMTP environment in which "MAIL FROM" is used. RFC 821, 1123.

Syntax

Visual Basic (Declaration)
Public Const ReturnPath As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ReturnPath
C#
public const string ReturnPath
Managed Extensions for C++
public: const string* ReturnPath
C++/CLI
public:
const String^ ReturnPath

See Also

Reference

HeaderKey Class
HeaderKey Members


ReturnReceiptTo Field

[image]
PowerTCP Mail for .NET
ReturnReceiptTo Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : ReturnReceiptTo Field

Glossary Item Box

"Return-Receipt-To".

Syntax

Visual Basic (Declaration)
Public Const ReturnReceiptTo As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.ReturnReceiptTo
C#
public const string ReturnReceiptTo
Managed Extensions for C++
public: const string* ReturnReceiptTo
C++/CLI
public:
const String^ ReturnReceiptTo

See Also

Reference

HeaderKey Class
HeaderKey Members


Sender Field

[image]
PowerTCP Mail for .NET
Sender Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Sender Field

Glossary Item Box

"Sender". The person or agent submitting the message to the network, if other than shown by the From: header. RFC 822, 1123.

Syntax

Visual Basic (Declaration)
Public Const Sender As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Sender
C#
public const string Sender
Managed Extensions for C++
public: const string* Sender
C++/CLI
public:
const String^ Sender

See Also

Reference

HeaderKey Class
HeaderKey Members


Status Field

[image]
PowerTCP Mail for .NET
Status Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Status Field

Glossary Item Box

"Status". A non-standard header field used by some servers to indicate the status of delivery for the message.

Syntax

Visual Basic (Declaration)
Public Const Status As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Status
C#
public const string Status
Managed Extensions for C++
public: const string* Status
C++/CLI
public:
const String^ Status

Remarks

Common values for this field include:

U - Message is not downloaded and not deleted

R - Message is read or downloaded

O - Message is old but not deleted

D - To be deleted

N - New (a new message may also be indicated by not having any Status header)

As this is a non-standard header field, implementations of this field may vary and use other values.

See Also

Reference

HeaderKey Class
HeaderKey Members


Subject Field

[image]
PowerTCP Mail for .NET
Subject Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : Subject Field

Glossary Item Box

"Subject". Topic of message. RFC 822, 1036.

Syntax

Visual Basic (Declaration)
Public Const Subject As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.Subject
C#
public const string Subject
Managed Extensions for C++
public: const string* Subject
C++/CLI
public:
const String^ Subject

See Also

Reference

HeaderKey Class
HeaderKey Members


To Field

[image]
PowerTCP Mail for .NET
To Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : To Field

Glossary Item Box

"To". Primary recipient mailbox(es). RFC 822, 1123.

Syntax

Visual Basic (Declaration)
Public Const To As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.To
C#
public const string To
Managed Extensions for C++
public: const string* To
C++/CLI
public:
const String^ To

See Also

Reference

HeaderKey Class
HeaderKey Members


XPriority Field

[image]
PowerTCP Mail for .NET
XPriority Field
See Also Send comments on this topic
Dart.Mail Namespace > HeaderKey Class : XPriority Field

Glossary Item Box

"X-Priority". Message priority. RFC 4021.

Syntax

Visual Basic (Declaration)
Public Const XPriority As String
Visual Basic (Usage) Copy Code
Dim value As String

value = HeaderKey.XPriority
C#
public const string XPriority
Managed Extensions for C++
public: const string* XPriority
C++/CLI
public:
const String^ XPriority

See Also

Reference

HeaderKey Class
HeaderKey Members


Htmlpart Class

[image]
PowerTCP Mail for .NET
Htmlpart Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Htmlpart Class

Glossary Item Box

Specializes Textpart using "text/html" ContentType.

Object Model

Htmlpart ClassContentDisposition ClassContentType ClassHeaderDictionary ClassHeaderField Class

Syntax

Visual Basic (Declaration)
Public Class Htmlpart
   Inherits Textpart
Visual Basic (Usage) Copy Code
Dim instance As Htmlpart
C#
public class Htmlpart : Textpart
Managed Extensions for C++
public __gc class Htmlpart : public Textpart
C++/CLI
public ref class Htmlpart : public Textpart

Inheritance Hierarchy

System.Object
Dart.Mail.Part
Dart.Mail.Resource
Dart.Mail.Textpart
Dart.Mail.Htmlpart

See Also

Reference

Htmlpart Members
Dart.Mail Namespace


Htmlpart Class Members

[image]
PowerTCP Mail for .NET
Htmlpart Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : Htmlpart Class

Glossary Item Box

The following tables list the members exposed by Htmlpart.

Public Constructors

 | Name | Description
Public Constructor | Htmlpart Constructor | Constructor used to create an Htmlpart.
Top

Public Properties

 | Name | Description
Public Property | Content | Sets or gets text content. Returns null if not initialized. (Inherited from Dart.Mail.Textpart)
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part. (Inherited from Dart.Mail.Resource)
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part. (Inherited from Dart.Mail.Resource)
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Encoding | The encoding to be used for text. (Inherited from Dart.Mail.Textpart)
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Returns the approximate Length of the encoded part. (Inherited from Dart.Mail.Textpart)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part. (Inherited from Dart.Mail.Resource)
Top

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values. (Inherited from Dart.Mail.Resource)
Public Method | Clone | Overridden. Creates a deep copy of the Htmlpart.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content. (Inherited from Dart.Mail.Resource)
Public Method | Dispose | Overloaded. Releases all resources associated with the object. (Inherited from Dart.Mail.Part)
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Resource)
Public Method | GetContentStream | Gets a MemoryStream that has been filled with encoded Textpart.Content. (Inherited from Dart.Mail.Textpart)
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType. (Inherited from Dart.Mail.Resource)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Htmlpart Class
Dart.Mail Namespace


Htmlpart Constructor

[image]
PowerTCP Mail for .NET
Htmlpart Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Htmlpart Class : Htmlpart Constructor

content
String value used to initialize Content.

Glossary Item Box

Constructor used to create an Htmlpart.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal content As String _
)
Visual Basic (Usage) Copy Code
Dim content As String

Dim instance As New Htmlpart(content)
C#
public Htmlpart(
   string content
)
Managed Extensions for C++
public: Htmlpart(
   string* content
)
C++/CLI
public:
Htmlpart(
   String^ content
)

Parameters

content
String value used to initialize Content.

Remarks

Content must be null when decoding (the encoding Stream is being written to), and not null when encoding (the encoding Stream is being read from).

See Also

Reference

Htmlpart Class
Htmlpart Members


Htmlpart Class Methods

[image]
PowerTCP Mail for .NET
Htmlpart Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Htmlpart Class

Glossary Item Box

For a list of all members of this type, see Htmlpart members.

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values. (Inherited from Dart.Mail.Resource)
Public Method | Clone | Overridden. Creates a deep copy of the Htmlpart.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content. (Inherited from Dart.Mail.Resource)
Public Method | Dispose | Overloaded. Releases all resources associated with the object. (Inherited from Dart.Mail.Part)
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Resource)
Public Method | GetContentStream | Gets a MemoryStream that has been filled with encoded Textpart.Content. (Inherited from Dart.Mail.Textpart)
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType. (Inherited from Dart.Mail.Resource)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Htmlpart Class
Dart.Mail Namespace


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > Htmlpart Class : Clone Method

Glossary Item Box

Creates a deep copy of the Htmlpart.

Syntax

Visual Basic (Declaration)
Public Overrides Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As Htmlpart
Dim value As Object

value = instance.Clone()
C#
public override object Clone()
Managed Extensions for C++
public: Object* Clone(); override
C++/CLI
public:
Object^ Clone(); override

Return Value

An Htmlpart

See Also

Reference

Htmlpart Class
Htmlpart Members


Imap Class

[image]
PowerTCP Mail for .NET
Imap Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Imap Class

Glossary Item Box

Integrates Internet Message Access Protocol (IMAP4) functionality into any .NET application.

Object Model

Imap ClassTcpBase ClassMailboxCollection ClassMailbox ClassMailbox ClassImapMessage ClassImapSession Class

Syntax

Visual Basic (Declaration)
Public Class Imap
   Inherits MailBase
Visual Basic (Usage) Copy Code
Dim instance As Imap
C#
public class Imap : MailBase
Managed Extensions for C++
public __gc class Imap : public MailBase
C++/CLI
public ref class Imap : public MailBase

Remarks

Use the Imap component to manage email that resides on an IMAP4 server. Download email on demand.

Using the Imap Component

Short descriptions of common features follow. For a more complete walk-through, see the high-level topics or the applicable reference topic.

Mailbox management: IMAP mailboxes are represented as Mailbox objects. Multiple Mailbox objects are contained in and managed by MailboxCollection. Use this object to add, remove, and modify IMAP mailboxes.

Message management: IMAP messages are represented as ImapMessage objects. Use properties to modify message flags. Multiple ImapMessage objects are managed by a Mailbox. Use this object to add and modify IMAP messages.

Message retrieval: Use Mailbox.Get to get messages in bulk. Use ImapMessage.Get to get a single message.

Part retrieval: Use ImapMessage.GetPart to get a single part (such as an attachment) from a message without downloading the entire message.

Comprehensive IMAP functionality: Perform all IMAP functions such as searching, listing, subscribing/unsubscribing, and retrieving message sections.

Advanced decoding: Messages are decoded "on the fly", making your application faster and more efficient.

Displaying Progress: Progress provides incremental notification of the number of bytes sent or received, both for a single messages and all messages.

Accessing Imap Protocol Communications: TcpBase.Log reports all commands and data sent over the TCP connection.

Info on the control connection: Connection provides access to low-level properties and methods. This can be used to view TCP-level activity, such as the local and remote IP address. Furthermore, the Proxy property of this object enables automatic communication with proxy servers when getting mail.

Sending commands to the server: Any command (including proprietary commands) can be sent to the IMAP server using Invoke(String).

Inheritance Hierarchy

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.Mail.ComponentBase
Dart.Mail.MailBase
Dart.Mail.Imap

See Also

Reference

Imap Members
Dart.Mail Namespace


Imap Class Members

[image]
PowerTCP Mail for .NET
Imap Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : Imap Class

Glossary Item Box

The following tables list the members exposed by Imap.

Public Constructors

 | Name | Description
Public Constructor | Imap Constructor | Initializes a new instance of the Imap component.
Top

Public Properties

 | Name | Description
Public Property | Capabilities | Gets a List of strings representing the capabilities of the server. (Inherited from Dart.Mail.MailBase)
Public Property | CommandCount | Gets the count of outstanding commands.
Public Property | Connection | TCP connection used for server communications.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Delimiter | Gets the delimiter used to separate mailbox levels.
Public Property | Encoding | Specifies the character encoding to be used by the component. (Inherited from Dart.Mail.MailBase)
Public Property | Mailboxes | Gets a MailboxCollection that contains a model of the server mailboxes.
Public Property | MailboxNameEncoding | Gets or sets the encoding used for Mailbox.Name. Defaults to ImapUTF7.
Public Property | SelectedMailbox | Gets or sets the selected Mailbox.
Public Property | ServerGreeting | Gets the greeting received after connecting to the server. (Inherited from Dart.Mail.MailBase)
Public Property | Session | Specifies connection, authentication and behavior configuration.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

Public Methods

 | Name | Description
Public Method | Authenticate | Authenticate the client using parameters from Imap.Session. Mailboxes will be populated when this method returns.
Public Method | Close | Logout and close the connection.
Public Method | Connect | Connect to an IMAP4 server using parameters specified in Session.
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | GetAllMailboxes | Walks the mailbox tree from the root and returns a flat list of all mailboxes advertised by the server.
static (Shared in Visual Basic) | GetDefaultPort | Returns the port normally used for the supplied MailSession configuration.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Idle | Informs the server it can send unsolicited mailbox update information. Blocks execution until a command is sent on another thread. The Update event is raised as each update is received.
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Invoke | Overloaded. Send the specified user command.
Public Method | List | Overloaded. Lists all root subscribed and un-subscribed mailboxes found on the IMAP server.
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | Noop | Send a NOOP command to reset any server session timeout and poll for changes.
Public Method | Select | Creates a new Mailbox and sets SelectedMailbox to this value.
Public Method | Start | Start a worker thread and execute the specified delegate. (Inherited from Dart.Mail.MailBase)
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnAlert | Raises the Alert event.
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnProgress | Raises the Progress event.
Protected Method | OnUpdate | Raises the Update event.
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

Public Events

 | Name | Description
Public Event | Alert | Raised when a response from the server contains an alert message.
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | Progress | Repeatedly raised while a message or message section is retrieved.
Public Event | Update | Raised when unsolicited data is received from the server.
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Imap Class
Dart.Mail Namespace


Imap Constructor

[image]
PowerTCP Mail for .NET
Imap Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : Imap Constructor

Glossary Item Box

Initializes a new instance of the Imap component.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Imap()
C#
public Imap()
Managed Extensions for C++
public: Imap();
C++/CLI
public:
Imap();

See Also

Reference

Imap Class
Imap Members


Imap Class Methods

[image]
PowerTCP Mail for .NET
Imap Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Imap Class

Glossary Item Box

For a list of all members of this type, see Imap members.

Public Methods

 | Name | Description
Public Method | Authenticate | Authenticate the client using parameters from Imap.Session. Mailboxes will be populated when this method returns.
Public Method | Close | Logout and close the connection.
Public Method | Connect | Connect to an IMAP4 server using parameters specified in Session.
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | GetAllMailboxes | Walks the mailbox tree from the root and returns a flat list of all mailboxes advertised by the server.
static (Shared in Visual Basic) | GetDefaultPort | Returns the port normally used for the supplied MailSession configuration.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Idle | Informs the server it can send unsolicited mailbox update information. Blocks execution until a command is sent on another thread. The Update event is raised as each update is received.
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Invoke | Overloaded. Send the specified user command.
Public Method | List | Overloaded. Lists all root subscribed and un-subscribed mailboxes found on the IMAP server.
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | Noop | Send a NOOP command to reset any server session timeout and poll for changes.
Public Method | Select | Creates a new Mailbox and sets SelectedMailbox to this value.
Public Method | Start | Start a worker thread and execute the specified delegate. (Inherited from Dart.Mail.MailBase)
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnAlert | Raises the Alert event.
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnProgress | Raises the Progress event.
Protected Method | OnUpdate | Raises the Update event.
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Imap Class
Dart.Mail Namespace


Authenticate Method

[image]
PowerTCP Mail for .NET
Authenticate Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : Authenticate Method

Glossary Item Box

Authenticate the client using parameters from Imap.Session. Mailboxes will be populated when this method returns.

Syntax

Visual Basic (Declaration)
Public Sub Authenticate()
Visual Basic (Usage) Copy Code
Dim instance As Imap

instance.Authenticate()
C#
public void Authenticate()
Managed Extensions for C++
public: void Authenticate();
C++/CLI
public:
void Authenticate();

Exceptions

Exception | Description
System.DllNotFoundException | "secur32.dll" - secur32.dll or one of its dependencies could not be loaded, which is required for GSSAPI and NTLM support. To resolve this exception, set Imap.Session.Authentication to a value other than Authentication.GssApi or Authentication.Ntlm.

Remarks

SSL security is negotiated if Session.Security.Encrypt == Encrypt.Explicit.

Example

This example demonstrates connecting to an Imap server, with options for encryption (Explicit/Implicit), and authenticating the user.
C# Copy Code
using System.Security.Cryptography.X509Certificates;
using System.Security.Authentication;
using System.Net.Security;

/// <summary>
/// Connects to an Imap server, optionally using encryption (Explicit/Implicit), and authenticates the user.
/// </summary>
/// <param name="myImap">The Imap instance to connect and authenticate</param>
/// <param name="hostNameOrAddress">The server's hostname or IP address</param>
/// <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
private void ConnectAndAuthenticate(Imap myImap, string hostNameOrAddress, Authentication auth, string username, string password, Encrypt encryption)
{
    if (encryption != Encrypt.None)
    {
        //Set the method of encryption - Implicit/Explicit
        myImap.Session.Security.Encrypt = encryption;

        //Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        //TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        myImap.Session.Security.Protocols = SslProtocols.Tls | SslProtocols.Ssl3;

        //Specify the server certificate validation callback
        myImap.Session.Security.ValidationCallback = remoteCertificateValidation;
    }

    //Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    //GetDefaultPort() returns the common port used for the security configuration.
    myImap.Session.RemoteEndPoint = new IPEndPoint(hostNameOrAddress, Imap.GetDefaultPort(myImap.Session));

    //Connect to the server.
    myImap.Connect();

    //Authenticate the user.
    myImap.Session.Username = username;
    myImap.Session.Password = password;
    myImap.Session.Authentication = auth;
    myImap.Authenticate();
}

private bool remoteCertificateValidation(Object sender, X509Certificate remoteCertificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    //the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    return true;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Authentication
Imports System.Net.Security

''' <summary>
''' Connects to an Imap server, optionally using encryption (Explicit/Implicit), and authenticates the user.
''' </summary>
''' <param name="myImap">The Imap instance to connect and authenticate</param>
''' <param name="hostNameOrAddress">The server's hostname or IP address</param>
''' <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
''' <param name="username">Username</param>
''' <param name="password">Password</param>
''' <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
Private Sub ConnectAndAuthenticate(ByVal myImap As Imap, ByVal hostNameOrAddress As String, ByVal auth As Authentication, ByVal username As String, ByVal password As String, ByVal encryption As Encrypt)
    If encryption <> Encrypt.None Then
        'Set the method of encryption - Implicit/Explicit
        myImap.Session.Security.Encrypt = encryption

        'Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        'TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        myImap.Session.Security.Protocols = SslProtocols.Tls Or SslProtocols.Ssl3

        'Specify the server certificate validation callback
        myImap.Session.Security.ValidationCallback = AddressOf remoteCertificateValidation
    End If

    'Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    'GetDefaultPort() returns the common port used for the security configuration.
    myImap.Session.RemoteEndPoint = New IPEndPoint(hostNameOrAddress, Imap.GetDefaultPort(myImap.Session))

    'Connect to the server.
    myImap.Connect()

    'Authenticate the user.
    myImap.Session.Username = username
    myImap.Session.Password = password
    myImap.Session.Authentication = auth
    myImap.Authenticate()
End Sub

Private Function remoteCertificateValidation(ByVal sender As Object, ByVal remoteCertificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    'the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    Return True
End Function

See Also

Reference

Imap Class
Imap Members


Close Method

[image]
PowerTCP Mail for .NET
Close Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : Close Method

Glossary Item Box

Logout and close the connection.

Syntax

Visual Basic (Declaration)
Public Function Close() As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As ImapResponse

value = instance.Close()
C#
public ImapResponse Close()
Managed Extensions for C++
public: ImapResponse* Close();
C++/CLI
public:
ImapResponse^ Close();

Example

In this example, the Imap component gets messages from a specified mailbox and saves them to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    //Specify folder to store messages
    string messageFolder = Application.StartupPath + "\\messages";

    //Download all messages in the account and save them to disk
    foreach (ImapMessage imapMessage in imap1.SelectedMailbox.ToArray())
    {
        imapMessage.Get();
        imapMessage.Message.Save(messageFolder + "\\" + imapMessage.Uid + ".eml");
    }

    //Gracefully logout of the session
    imap1.Close();
}

private void imap1_Progress(object sender, ImapProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    'Specify folder to store messages
    Dim messageFolder As String = Application.StartupPath & "\messages"

    'Download all messages in the account and save them to disk
    For Each imapMessage As ImapMessage In imap1.SelectedMailbox.ToArray()
        imapMessage.Get()
        imapMessage.Message.Save(messageFolder & "\" & imapMessage.Uid & ".eml")
    Next imapMessage

    'Gracefully logout of the session
    imap1.Close()
End Sub

Private Sub imap1_Progress(ByVal sender As Object, ByVal e As ImapProgressEventArgs) Handles imap1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Imap Class
Imap Members


Connect Method

[image]
PowerTCP Mail for .NET
Connect Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : Connect Method

Glossary Item Box

Connect to an IMAP4 server using parameters specified in Session.

Syntax

Visual Basic (Declaration)
Public Sub Connect()
Visual Basic (Usage) Copy Code
Dim instance As Imap

instance.Connect()
C#
public void Connect()
Managed Extensions for C++
public: void Connect();
C++/CLI
public:
void Connect();

Remarks

SSL encryption is negotiated if Session.Security.Encrypt == Encrypt.Implicit.

Imap.Capabilities is populated after connecting.

If Session.RemoteEndPoint.Port is 0, the default port for the current Session configuration will be used.

Authenticate is normally used after this method. If not, it is up to the application to send any necessary authentication commands to the server.

Example

This example demonstrates connecting to an Imap server, with options for encryption (Explicit/Implicit), and authenticating the user.
C# Copy Code
using System.Security.Cryptography.X509Certificates;
using System.Security.Authentication;
using System.Net.Security;

/// <summary>
/// Connects to an Imap server, optionally using encryption (Explicit/Implicit), and authenticates the user.
/// </summary>
/// <param name="myImap">The Imap instance to connect and authenticate</param>
/// <param name="hostNameOrAddress">The server's hostname or IP address</param>
/// <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
private void ConnectAndAuthenticate(Imap myImap, string hostNameOrAddress, Authentication auth, string username, string password, Encrypt encryption)
{
    if (encryption != Encrypt.None)
    {
        //Set the method of encryption - Implicit/Explicit
        myImap.Session.Security.Encrypt = encryption;

        //Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        //TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        myImap.Session.Security.Protocols = SslProtocols.Tls | SslProtocols.Ssl3;

        //Specify the server certificate validation callback
        myImap.Session.Security.ValidationCallback = remoteCertificateValidation;
    }

    //Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    //GetDefaultPort() returns the common port used for the security configuration.
    myImap.Session.RemoteEndPoint = new IPEndPoint(hostNameOrAddress, Imap.GetDefaultPort(myImap.Session));

    //Connect to the server.
    myImap.Connect();

    //Authenticate the user.
    myImap.Session.Username = username;
    myImap.Session.Password = password;
    myImap.Session.Authentication = auth;
    myImap.Authenticate();
}

private bool remoteCertificateValidation(Object sender, X509Certificate remoteCertificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    //the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    return true;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Authentication
Imports System.Net.Security

''' <summary>
''' Connects to an Imap server, optionally using encryption (Explicit/Implicit), and authenticates the user.
''' </summary>
''' <param name="myImap">The Imap instance to connect and authenticate</param>
''' <param name="hostNameOrAddress">The server's hostname or IP address</param>
''' <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
''' <param name="username">Username</param>
''' <param name="password">Password</param>
''' <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
Private Sub ConnectAndAuthenticate(ByVal myImap As Imap, ByVal hostNameOrAddress As String, ByVal auth As Authentication, ByVal username As String, ByVal password As String, ByVal encryption As Encrypt)
    If encryption <> Encrypt.None Then
        'Set the method of encryption - Implicit/Explicit
        myImap.Session.Security.Encrypt = encryption

        'Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        'TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        myImap.Session.Security.Protocols = SslProtocols.Tls Or SslProtocols.Ssl3

        'Specify the server certificate validation callback
        myImap.Session.Security.ValidationCallback = AddressOf remoteCertificateValidation
    End If

    'Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    'GetDefaultPort() returns the common port used for the security configuration.
    myImap.Session.RemoteEndPoint = New IPEndPoint(hostNameOrAddress, Imap.GetDefaultPort(myImap.Session))

    'Connect to the server.
    myImap.Connect()

    'Authenticate the user.
    myImap.Session.Username = username
    myImap.Session.Password = password
    myImap.Session.Authentication = auth
    myImap.Authenticate()
End Sub

Private Function remoteCertificateValidation(ByVal sender As Object, ByVal remoteCertificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    'the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    Return True
End Function

See Also

Reference

Imap Class
Imap Members


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : Dispose Method

Glossary Item Box

Releases all resources associated with the object.

Overload List

Overload | Description
Dispose(Boolean) | Releases all resources associated with the object.
Dispose() | (Inherited from System.ComponentModel.Component)

See Also

Reference

Imap Class
Imap Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method abruptly aborts the connection, releases all resources, and deletes any unmoved decoded attachments and Attachment.Directory.

Dispose should ONLY be used to release all resources used by the object, and the object should not be subsequently used. To gracefully disconnect from the server, use Close before calling this method. The Object cannot be used once Dispose is called.

See Also

Reference

Imap Class
Imap Members
Overload List


GetAllMailboxes Method

[image]
PowerTCP Mail for .NET
GetAllMailboxes Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : GetAllMailboxes Method

Glossary Item Box

Walks the mailbox tree from the root and returns a flat list of all mailboxes advertised by the server.

Syntax

Visual Basic (Declaration)
Public Function GetAllMailboxes() As List(Of Mailbox)
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As List(Of Mailbox)

value = instance.GetAllMailboxes()
C#
public List<Mailbox> GetAllMailboxes()
Managed Extensions for C++
public: List<Mailbox*>* GetAllMailboxes();
C++/CLI
public:
List<Mailbox^>^ GetAllMailboxes();

Return Value

A flat list of all mailboxes advertised by the server.

Remarks

Uses Mailbox.Mailboxes and MailboxCollection.Refresh to walk the mailbox tree, re-populating the hierarchy of nested mailboxes using the LIST and LSUB commands.

See Also

Reference

Imap Class
Imap Members


GetDefaultPort Method

[image]
PowerTCP Mail for .NET
GetDefaultPort Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : GetDefaultPort Method

session
The MailSession to use for determining the port.

Glossary Item Box

Returns the port normally used for the supplied MailSession configuration.

Syntax

Visual Basic (Declaration)
Public Shared Function GetDefaultPort( _
   ByVal session As MailSession _
) As Integer
Visual Basic (Usage) Copy Code
Dim session As MailSession
Dim value As Integer

value = Imap.GetDefaultPort(session)
C#
public static int GetDefaultPort(
   MailSession session
)
Managed Extensions for C++
public: static int GetDefaultPort(
   MailSession* session
)
C++/CLI
public:
static int GetDefaultPort(
   MailSession^ session
)

Parameters

session
The MailSession to use for determining the port.

Return Value

The port normally used for the supplied MailSession configuration.

Remarks

If MailSecurity.Encrypt == Encrypt.Implicit, port 993 is returned (the well-known secure IMAP4 server port). Otherwise, 143 is returned (the well-known IMAP4 server port).

Used to initialize Session.RemoteEndPoint.Port if not initialized by the user.

See Also

Reference

Imap Class
Imap Members


Idle Method

[image]
PowerTCP Mail for .NET
Idle Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : Idle Method

Glossary Item Box

Informs the server it can send unsolicited mailbox update information. Blocks execution until a command is sent on another thread. The Update event is raised as each update is received.

Syntax

Visual Basic (Declaration)
Public Function Idle() As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As ImapResponse

value = instance.Idle()
C#
public ImapResponse Idle()
Managed Extensions for C++
public: ImapResponse* Idle();
C++/CLI
public:
ImapResponse^ Idle();

Exceptions

Exception | Description
System.InvalidOperationException | A Mailbox is not selected.
System.NotSupportedException | Server does not support the IDLE command.

Remarks

RFC 2177 defines the IDLE command that indicates the client desires unsolicited updates for the selected mailbox. This method blocks until the user sends another command (on another thread). While blocking, the Update event is raised as each update is received.

For single-threaded applications, use Noop to poll for updates. For multi-threaded applications, call Idle() on a worker thread, where it will block until the client sends another command (on the UI thread or on a different worker thread).

Example

This example demonstrates use of the Idle method and the Update event.
C# Copy Code
/// <summary>
/// Used here as a stand-in for any collection that should be updated to reflect
/// the current state of messages on the server, such as a ListView.Items collection.
/// </summary>
Dictionary<string, ImapMessage> independentImapMessageCollection = new Dictionary<string, ImapMessage>();

private void button1_Click(object sender, EventArgs e)
{
    //Set server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Start a worker thread
    //This allows the function to execute without blocking the UI
    imap1.Start(listenForUpdates, null);
}

private void button2_Click(object sender, EventArgs e)
{
    //Set server and account info
    smtp1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(mySmtpServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send a message to trigger an exists update.
    smtp1.Send(myEmail, myEmail, "Test Message", "Test Message");
}

private void listenForUpdates(object state)
{
    //This function executes on a worker thread
    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Set the current mailbox to INBOX
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    //Retrieve all messages in the mailbox
    imap1.SelectedMailbox.Get();

    //Add the retrieved messages to the independent collection of ImapMessages
    foreach (ImapMessage message in imap1.SelectedMailbox.ToArray())
        independentImapMessageCollection.Add(message.Uid, message);

    //Initiate Idle to await new updates from server
    imap1.Idle();

    //Idle() returns once the client intiates communication with the server (on a different thread).
    System.Diagnostics.Debug.WriteLine("DONE IDLING");
}

private void imap1_Update(object sender, ImapUpdateEventArgs e)
{
    switch (e.Response.Operation)
    {
        case "EXPUNGE":
            //Remove message(s) from any independently implemented collection
            foreach (ImapMessage msg in e.Messages)
                independentImapMessageCollection.Remove(msg.Uid);
            break;

        case "EXISTS":
            //Retrieve the new messages on a worker thread
            imap1.Start(getMessages, e.Messages);
            break;
    }
}

/// <summary>
/// When the server informs the client of new messages, download the new messages (interrupts IDLE).
/// </summary>
void getMessages(object msgs)
{
    //Executes on a worker thread so UI messages are not interrupted.
    //Cast msgs back to ImapMessage array
    ImapMessage[] messages = msgs as ImapMessage[];

    //Retrieve the new messages from the server. This interrupts IDLE.
    imap1.SelectedMailbox.Get(messages, ImapMessageInfo.Message);

    //Update the independent collection
    foreach (ImapMessage message in messages)
        independentImapMessageCollection.Add(message.Uid, message);

    //Resume Idle to await new updates from server
    imap1.Idle();

    //Idle() returns once the client intiates communication with the server (on a different thread).
    System.Diagnostics.Debug.WriteLine("DONE IDLING");
}
Visual Basic Copy Code
''' <summary>
''' Used here as a stand-in for any collection that should be updated to reflect
''' the current state of messages on the server, such as a ListView.Items collection.
''' </summary>
Private independentImapMessageCollection As New Dictionary(Of String, ImapMessage)()

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    'Set server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Start a worker thread
    'This allows the function to execute without blocking the UI
    imap1.Start(AddressOf listenForUpdates, Nothing)
End Sub

Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click
    'Set server and account info
    smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(mySmtpServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send a message to trigger an exists update.
    smtp1.Send(myEmail, myEmail, "Test Message", "Test Message")
End Sub

Private Sub listenForUpdates(ByVal state As Object)
    'This function executes on a worker thread
    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Set the current mailbox to INBOX
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    'Retrieve all messages in the mailbox
    imap1.SelectedMailbox.Get()

    'Add the retrieved messages to the independent collection of ImapMessages
    For Each message As ImapMessage In imap1.SelectedMailbox.ToArray()
        independentImapMessageCollection.Add(message.Uid, message)
    Next message

    'Initiate Idle to await new updates from server
    imap1.Idle()

    'Idle() returns once the client intiates communication with the server (on a different thread).
    System.Diagnostics.Debug.WriteLine("DONE IDLING")
End Sub

Private Sub imap1_Update(ByVal sender As Object, ByVal e As ImapUpdateEventArgs) Handles imap1.Update
    Select Case e.Response.Operation
        Case "EXPUNGE"
            'Remove message(s) from any independently implemented collection
            For Each msg As ImapMessage In e.Messages
                independentImapMessageCollection.Remove(msg.Uid)
            Next msg

        Case "EXISTS"
            'Retrieve the new messages on a worker thread
            imap1.Start(AddressOf getMessages, e.Messages)
    End Select
End Sub

''' <summary>
''' When the server informs the client of new messages, download the new messages (interrupts IDLE).
''' </summary>
Private Sub getMessages(ByVal msgs As Object)
    'Executes on a worker thread so UI messages are not interrupted.
    'Cast msgs back to ImapMessage array
    Dim messages() As ImapMessage = TryCast(msgs, ImapMessage())

    'Retrieve the new messages from the server. This interrupts IDLE.
    imap1.SelectedMailbox.Get(messages, ImapMessageInfo.Message)

    'Update the independent collection
    For Each message As ImapMessage In messages
        independentImapMessageCollection.Add(message.Uid, message)
    Next message

    'Resume Idle to await new updates from server
    imap1.Idle()

    'Idle() returns once the client intiates communication with the server (on a different thread).
    System.Diagnostics.Debug.WriteLine("DONE IDLING")
End Sub

See Also

Reference

Imap Class
Imap Members


Invoke Method

[image]
PowerTCP Mail for .NET
Invoke Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : Invoke Method

Glossary Item Box

Send the specified user command.

Overload List

Overload | Description
Invoke(String) | Send the specified user command.
Invoke(String,Byte[]) | Send the specified user command.

See Also

Reference

Imap Class
Imap Members


Invoke(String) Method

[image]
PowerTCP Mail for .NET
Invoke(String) Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class > Invoke Method : Invoke(String) Method

command
The command to send to the server.

Glossary Item Box

Send the specified user command.

Syntax

Visual Basic (Declaration)
Public Overloads Function Invoke( _
   ByVal command As String _
) As ImapResponse()
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim command As String
Dim value() As ImapResponse

value = instance.Invoke(command)
C#
public ImapResponse[] Invoke(
   string command
)
Managed Extensions for C++
public: ImapResponse*[]* Invoke(
   string* command
)
C++/CLI
public:
array<ImapResponse^>^ Invoke(
   String^ command
)

Parameters

command
The command to send to the server.

Return Value

An ImapResponse array representing the response(s) from the server.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | Socket connectivity problem.

Remarks

This is useful for communicating with servers that recognize proprietary commands not included in the Imap component model.

See Also

Reference

Imap Class
Imap Members
Overload List


Invoke(String,Byte[]) Method

[image]
PowerTCP Mail for .NET
Invoke(String,Byte[]) Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class > Invoke Method : Invoke(String,Byte[]) Method

command
The command to send to the server.
data
The data to send after the server responds to the command.

Glossary Item Box

Send the specified user command.

Syntax

Visual Basic (Declaration)
Public Overloads Function Invoke( _
   ByVal command As String, _
   ByVal data() As Byte _
) As ImapResponse()
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim command As String
Dim data() As Byte
Dim value() As ImapResponse

value = instance.Invoke(command, data)
C#
public ImapResponse[] Invoke(
   string command,
   byte[] data
)
Managed Extensions for C++
public: ImapResponse*[]* Invoke(
   string* command,
   byte[]* data
)
C++/CLI
public:
array<ImapResponse^>^ Invoke(
   String^ command,
   array<byte>^ data
)

Parameters

command
The command to send to the server.
data
The data to send after the server responds to the command.

Return Value

An ImapResponse array representing the response(s) from the server.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | Socket connectivity problem.

Remarks

This is useful for communicating with servers that recognize proprietary commands not included in the Imap component model.

data is sent as a literal following any continuation responses from the IMAP server. This follows the APPEND command model, where the APPEND command is issued, the server issues a continuation response, and the actual message data is then sent.

See Also

Reference

Imap Class
Imap Members
Overload List


List Method

[image]
PowerTCP Mail for .NET
List Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : List Method

Glossary Item Box

Lists all root subscribed and un-subscribed mailboxes found on the IMAP server.

Overload List

Overload | Description
List() | Lists all root subscribed and un-subscribed mailboxes found on the IMAP server.
List(String,String,Boolean) | Lists a subset of mailboxes found on the IMAP server.

See Also

Reference

Imap Class
Imap Members


List() Method

[image]
PowerTCP Mail for .NET
List() Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class > List Method : List() Method

Glossary Item Box

Lists all root subscribed and un-subscribed mailboxes found on the IMAP server.

Syntax

Visual Basic (Declaration)
Public Overloads Function List() As Mailbox()
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value() As Mailbox

value = instance.List()
C#
public Mailbox[] List()
Managed Extensions for C++
public: Mailbox*[]* List();
C++/CLI
public:
array<Mailbox^>^ List();

Return Value

A Mailbox array.

Remarks

Calls List(String,String,Boolean) using "" for directory, "%" for searchTerm, and false for subscribedOnly.

This method does not update Mailboxes; use Imap.Mailboxes.Refresh() to refresh its contents.

If Imap.Session.AutoUtf8 is set to true, and the server advertises UTF8=ACCEPT, UTF8 will be used for encoding and decoding UNICODE strings.

See Also

Reference

Imap Class
Imap Members
Overload List


List(String,String,Boolean) Method

[image]
PowerTCP Mail for .NET
List(String,String,Boolean) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class > List Method : List(String,String,Boolean) Method

directory
The directory in which to execute the command.
searchTerm
Checks against all mailboxes for matches, and may include wildcards.
subscribedOnly
True to only return Mailboxes the user is subscribed to (use the IMAP LSUB command).

Glossary Item Box

Lists a subset of mailboxes found on the IMAP server.

Syntax

Visual Basic (Declaration)
Public Overloads Function List( _
   ByVal directory As String, _
   ByVal searchTerm As String, _
   ByVal subscribedOnly As Boolean _
) As Mailbox()
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim directory As String
Dim searchTerm As String
Dim subscribedOnly As Boolean
Dim value() As Mailbox

value = instance.List(directory, searchTerm, subscribedOnly)
C#
public Mailbox[] List(
   string directory,
   string searchTerm,
   bool subscribedOnly
)
Managed Extensions for C++
public: Mailbox*[]* List(
   string* directory,
   string* searchTerm,
   bool subscribedOnly
)
C++/CLI
public:
array<Mailbox^>^ List(
   String^ directory,
   String^ searchTerm,
   bool subscribedOnly
)

Parameters

directory
The directory in which to execute the command.
searchTerm
Checks against all mailboxes for matches, and may include wildcards.
subscribedOnly
True to only return Mailboxes the user is subscribed to (use the IMAP LSUB command).

Return Value

A Mailbox array.

Remarks

This method does not update Mailboxes; use Imap.Mailboxes.Refresh() to refresh its contents.

If Imap.Session.AutoUtf8 is set to true, and the server advertises UTF8=ACCEPT, UTF8 will be used for encoding and decoding UNICODE strings.

Example

This example demonstrates how to create, rename and delete a mailbox. It also shows how to subscribe and unsubscribe a mailbox.
C# Copy Code
private void doMailboxFunctions(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Create a mailbox
    Mailbox newBox = imap1.Mailboxes.Add("My_New_Box");

    //Subscribe the mailbox and check the subscribed list
    newBox.Subscribe();
    //Get all subscribed mailboxes
    List<Mailbox> list = imap1.List("", "%", true).ToList<Mailbox>();
    if (!list.Contains(newBox)) throw new Exception("Server did not subscribe the mailbox.");

    //Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe();
    list = imap1.List("", "%", true).ToList<Mailbox>();
    if (list.Contains(newBox)) throw new Exception("Server did not unsubscribe the mailbox.");

    //Rename the mailbox and then delete it
    newBox.Name = newBox.Name + "_Renamed";
    imap1.Mailboxes.Remove(newBox);

    //Gracefully logout of the session
    imap1.Close();
}
Visual Basic Copy Code
Private Sub doMailboxFunctions(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Create a mailbox
    Dim newBox As Mailbox = imap1.Mailboxes.Add("My_New_Box")

    'Subscribe the mailbox and check the subscribed list
    newBox.Subscribe()
    'Get all subscribed mailboxes
    Dim list As List(Of Mailbox) = imap1.List("", "%", True).ToList()
    If Not list.Contains(newBox) Then
        Throw New Exception("Server did not subscribe the mailbox.")
    End If

    'Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe()
    list = imap1.List("", "%", True).ToList()
    If list.Contains(newBox) Then
        Throw New Exception("Server did not unsubscribe the mailbox.")
    End If

    'Rename the mailbox and then delete it
    newBox.Name = newBox.Name & "_Renamed"
    imap1.Mailboxes.Remove(newBox)

    'Gracefully logout of the session
    imap1.Close()
End Sub

See Also

Reference

Imap Class
Imap Members
Overload List


Noop Method

[image]
PowerTCP Mail for .NET
Noop Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : Noop Method

Glossary Item Box

Send a NOOP command to reset any server session timeout and poll for changes.

Syntax

Visual Basic (Declaration)
Public Function Noop() As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As ImapResponse

value = instance.Noop()
C#
public ImapResponse Noop()
Managed Extensions for C++
public: ImapResponse* Noop();
C++/CLI
public:
ImapResponse^ Noop();

Return Value

An ImapResponse object representing the response from the server. Any changes to the Mailbox are included.

Remarks

This resets any server session timeout and checks for changes in the current mailbox. If the server support IDLE, use Idle instead to receive Mailbox updates without polling. Unsolicited responses are reported by the Update event.

See Also

Reference

Imap Class
Imap Members


OnAlert Method

[image]
PowerTCP Mail for .NET
OnAlert Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : OnAlert Method

e
An ImapAlertEventArgs containing event data.

Glossary Item Box

Raises the Alert event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnAlert( _
   ByVal e As ImapAlertEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim e As ImapAlertEventArgs

instance.OnAlert(e)
C#
protected virtual void OnAlert(
   ImapAlertEventArgs e
)
Managed Extensions for C++
protected: virtual void OnAlert(
   ImapAlertEventArgs* e
)
C++/CLI
protected:
virtual void OnAlert(
   ImapAlertEventArgs^ e
)

Parameters

e
An ImapAlertEventArgs containing event data.

Remarks

This method allows derived classes to handle the event without attaching a delegate; marshaling to the UI thread is not provided. This is the preferred technique for handling an event in a derived class.

Note to Inheritors: When overriding OnUpdate in a derived class, be sure to call the base class OnAlert method so that registered delegates receive the event.

See Also

Reference

Imap Class
Imap Members


OnProgress Method

[image]
PowerTCP Mail for .NET
OnProgress Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : OnProgress Method

e
An ImapProgressEventArgs containing event data.

Glossary Item Box

Raises the Progress event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnProgress( _
   ByVal e As ImapProgressEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim e As ImapProgressEventArgs

instance.OnProgress(e)
C#
protected virtual void OnProgress(
   ImapProgressEventArgs e
)
Managed Extensions for C++
protected: virtual void OnProgress(
   ImapProgressEventArgs* e
)
C++/CLI
protected:
virtual void OnProgress(
   ImapProgressEventArgs^ e
)

Parameters

e
An ImapProgressEventArgs containing event data.

Remarks

This method allows derived classes to handle the event without attaching a delegate; marshaling to the UI thread is not provided. This is the preferred technique for handling an event in a derived class.

Note to Inheritors: When overriding OnProgress in a derived class, be sure to call the base class OnProgress method so that registered delegates receive the event.

See Also

Reference

Imap Class
Imap Members


OnUpdate Method

[image]
PowerTCP Mail for .NET
OnUpdate Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : OnUpdate Method

e
An ImapUpdateEventArgs containing event data.

Glossary Item Box

Raises the Update event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnUpdate( _
   ByVal e As ImapUpdateEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim e As ImapUpdateEventArgs

instance.OnUpdate(e)
C#
protected virtual void OnUpdate(
   ImapUpdateEventArgs e
)
Managed Extensions for C++
protected: virtual void OnUpdate(
   ImapUpdateEventArgs* e
)
C++/CLI
protected:
virtual void OnUpdate(
   ImapUpdateEventArgs^ e
)

Parameters

e
An ImapUpdateEventArgs containing event data.

Remarks

This method allows derived classes to handle the event without attaching a delegate; marshaling to the UI thread is not provided. This is the preferred technique for handling an event in a derived class.

Note to Inheritors: When overriding OnUpdate in a derived class, be sure to call the base class OnUpdate method so that registered delegates receive the event.

See Also

Reference

Imap Class
Imap Members


Select Method

[image]
PowerTCP Mail for .NET
Select Method
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : Select Method

mailboxPath
An absolute path to the desired mailbox, with mailbox names delimited by Delimiter.

Glossary Item Box

Creates a new Mailbox and sets SelectedMailbox to this value.

Syntax

Visual Basic (Declaration)
Public Function Select( _
   ByVal mailboxPath As String _
) As Mailbox
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim mailboxPath As String
Dim value As Mailbox

value = instance.Select(mailboxPath)
C#
public Mailbox Select(
   string mailboxPath
)
Managed Extensions for C++
public: Mailbox* Select(
   string* mailboxPath
)
C++/CLI
public:
Mailbox^ Select(
   String^ mailboxPath
)

Parameters

mailboxPath
An absolute path to the desired mailbox, with mailbox names delimited by Delimiter.

Return Value

Returns a Mailbox that is in the selected state (it is assigned to SelectedMailbox).

Remarks

Mailboxes and Mailbox.Mailboxes present a tree of mailboxes that can be selected by assigning one to the SelectedMailbox property. But in many scenarios, the path of the desired mailbox is known and the complete hierarchy is not relevant. In that case this method can be used to directly select a mailbox by specifying its absolute path. Delimiter returns the server's path delimiter if it is not known.

The component will send a SELECT command to initialize Mailbox.FirstUnseen, Mailbox.Marked, Mailbox.Recent, Mailbox.Selectable, and Mailbox.SublevelsAllowed. The server now considers this Mailbox to be in the "Selected" state and messages can be accessed.

The nature of IMAP is that other clients can delete messages on the server at anytime, so using "foreach" to enumerate the messages in a mailbox is not recommended (unsolicited responses may require the removal of the message from the Mailbox before the enumeration completes). Instead, use "foreach" on SelectedMailbox.ToArray(). If, during this enumeration, a message is deleted by another client, MessageBase.Id will be set to 0, so this value can be checked to ensure the existence of the message before acting upon it.

If Imap.Session.AutoUtf8 is set to true, and the server advertises UTF8=ACCEPT, UTF8 will be used for encoding and decoding UNICODE strings.

See Also

Reference

Imap Class
Imap Members


Imap Class Properties

[image]
PowerTCP Mail for .NET
Imap Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Imap Class

Glossary Item Box

For a list of all members of this type, see Imap members.

Public Properties

 | Name | Description
Public Property | Capabilities | Gets a List of strings representing the capabilities of the server. (Inherited from Dart.Mail.MailBase)
Public Property | CommandCount | Gets the count of outstanding commands.
Public Property | Connection | TCP connection used for server communications.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Delimiter | Gets the delimiter used to separate mailbox levels.
Public Property | Encoding | Specifies the character encoding to be used by the component. (Inherited from Dart.Mail.MailBase)
Public Property | Mailboxes | Gets a MailboxCollection that contains a model of the server mailboxes.
Public Property | MailboxNameEncoding | Gets or sets the encoding used for Mailbox.Name. Defaults to ImapUTF7.
Public Property | SelectedMailbox | Gets or sets the selected Mailbox.
Public Property | ServerGreeting | Gets the greeting received after connecting to the server. (Inherited from Dart.Mail.MailBase)
Public Property | Session | Specifies connection, authentication and behavior configuration.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

See Also

Reference

Imap Class
Dart.Mail Namespace


CommandCount Property

[image]
PowerTCP Mail for .NET
CommandCount Property
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : CommandCount Property

Glossary Item Box

Gets the count of outstanding commands.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property CommandCount As Integer
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As Integer

value = instance.CommandCount
C#
public int CommandCount {get;}
Managed Extensions for C++
public: __property int get_CommandCount();
C++/CLI
public:
property int CommandCount {
   int get();
}

Remarks

CommandCount represents the total number of commands waiting to execute as well as the current command executing. All commands lock on ComponentBase.SyncRoot to synchronize threads. Idle should not normally be be used when a command is executing.

See Also

Reference

Imap Class
Imap Members


Connection Property

[image]
PowerTCP Mail for .NET
Connection Property
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : Connection Property

Glossary Item Box

TCP connection used for server communications.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Connection As TcpBase
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As TcpBase

value = instance.Connection
C#
public TcpBase Connection {get;}
Managed Extensions for C++
public: __property TcpBase* get_Connection();
C++/CLI
public:
property TcpBase^ Connection {
   TcpBase^ get();
}

Property Value

TcpBase

See Also

Reference

Imap Class
Imap Members


Delimiter Property

[image]
PowerTCP Mail for .NET
Delimiter Property
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : Delimiter Property

Glossary Item Box

Gets the delimiter used to separate mailbox levels.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Delimiter As Char
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As Char

value = instance.Delimiter
C#
public char Delimiter {get;}
Managed Extensions for C++
public: __property char get_Delimiter();
C++/CLI
public:
property char Delimiter {
   char get();
}

Remarks

Returns the delimiter character which is used by the server to indicate mailbox hierarchy (ex. for a mailbox at "INBOX\spam", "\" is returned).

See Also

Reference

Imap Class
Imap Members


Mailboxes Property

[image]
PowerTCP Mail for .NET
Mailboxes Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : Mailboxes Property

Glossary Item Box

Gets a MailboxCollection that contains a model of the server mailboxes.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Mailboxes As MailboxCollection
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As MailboxCollection

value = instance.Mailboxes
C#
public MailboxCollection Mailboxes {get;}
Managed Extensions for C++
public: __property MailboxCollection* get_Mailboxes();
C++/CLI
public:
property MailboxCollection^ Mailboxes {
   MailboxCollection^ get();
}

Property Value

MailboxCollection that contains available mailboxes.

Remarks

The collection is sorted alphabetically, with the delimiter counted as a higher value than any other character. Only top-level mailboxes are included. Automatically populated after authentication.

Example

The following example demonstrates navigating into/selecting the specified subfolder/sub-mailbox.
C# Copy Code
/// <summary>
/// Navigates into the subfolder/sub-mailbox specified by 'subfolderPath'.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance</param>
/// <param name="subfolderPath">Path to the subfolder from root, delimited by '/' in this snippet.</param>
/// <remarks>
/// Imap.Select() may be used to access the path directly, but it will not populate the surrounding mailbox tree.
/// </remarks>
public void NavigateToSubfolder(Imap myImap, string subfolderPath)
{
    //Separate provided path into each subfolder name
    string[] subfolderNameArray = subfolderPath.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);

    //myImap.Mailboxes will already be populated by myImap.Authenticate(), so set to the first subfolder
    Mailbox currentMailbox = myImap.Mailboxes[subfolderNameArray[0]];

    //Subfolders (currentMailbox.Mailboxes) will not be populated, so start drilling down
    for (int i = 1; i <= subfolderNameArray.Length - 1; i++)
    {
        //If the entire mailbox structure was not populated upon login, refresh it now
        if(!myImap.Session.PopulateMailboxTree)
            currentMailbox.Mailboxes.Refresh();
        currentMailbox = currentMailbox.Mailboxes[subfolderNameArray[i]];
    }

    //Now that the end of the specified path has been reached, select that mailbox
    myImap.SelectedMailbox = currentMailbox;
}
Visual Basic Copy Code
''' <summary>
''' Navigates into the subfolder/sub-mailbox specified by 'subfolderPath'.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance</param>
''' <param name="subfolderPath">Path to the subfolder from root, delimited by '/' in this snippet.</param>
''' <remarks>
''' Imap.Select() may be used to access the path directly, but it will not populate the surrounding mailbox tree.
''' </remarks>
Public Sub NavigateToSubfolder(ByVal myImap As Imap, ByVal subfolderPath As String)
    'Separate provided path into each subfolder name
    Dim subfolderNameArray() As String = subfolderPath.Split(New String() { "/" }, StringSplitOptions.RemoveEmptyEntries)

    'myImap.Mailboxes will already be populated by myImap.Authenticate(), so set to the first subfolder
    Dim currentMailbox As Mailbox = myImap.Mailboxes(subfolderNameArray(0))

    'Subfolders (currentMailbox.Mailboxes) will not be populated, so start drilling down
    For i As Integer = 1 To subfolderNameArray.Length - 1
        'If the entire mailbox structure was not populated upon login, refresh it now
        If Not myImap.Session.PopulateMailboxTree Then
            currentMailbox.Mailboxes.Refresh()
        End If
        currentMailbox = currentMailbox.Mailboxes(subfolderNameArray(i))
    Next i

    'Now that the end of the specified path has been reached, select that mailbox
    myImap.SelectedMailbox = currentMailbox
End Sub

See Also

Reference

Imap Class
Imap Members


MailboxNameEncoding Property

[image]
PowerTCP Mail for .NET
MailboxNameEncoding Property
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : MailboxNameEncoding Property

Glossary Item Box

Gets or sets the encoding used for Mailbox.Name. Defaults to ImapUTF7.

Syntax

Visual Basic (Declaration)
Public Property MailboxNameEncoding As Encoding
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As Encoding

instance.MailboxNameEncoding = value

value = instance.MailboxNameEncoding
C#
public Encoding MailboxNameEncoding {get; set;}
Managed Extensions for C++
public: __property Encoding* get_MailboxNameEncoding();
public: __property void set_MailboxNameEncoding(
   Encoding* value
);
C++/CLI
public:
property Encoding^ MailboxNameEncoding {
   Encoding^ get();
   void set (    Encoding^ value);
}

Property Value

The encoding used for Name.

Remarks

Most IMAP servers use a modified UTF-7 encoding for mailbox names, but not all. The user may set this property to an alternative encoding if it is known what encoding the Imap server is using.

This property is set to null when the "UTF8=ACCEPT" capability is enabled.

See Also

Reference

Imap Class
Imap Members


SelectedMailbox Property

[image]
PowerTCP Mail for .NET
SelectedMailbox Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : SelectedMailbox Property

Glossary Item Box

Gets or sets the selected Mailbox.

Syntax

Visual Basic (Declaration)
Public Property SelectedMailbox As Mailbox
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As Mailbox

instance.SelectedMailbox = value

value = instance.SelectedMailbox
C#
public Mailbox SelectedMailbox {get; set;}
Managed Extensions for C++
public: __property Mailbox* get_SelectedMailbox();
public: __property void set_SelectedMailbox(
   Mailbox* value
);
C++/CLI
public:
property Mailbox^ SelectedMailbox {
   Mailbox^ get();
   void set (    Mailbox^ value);
}

Property Value

Returns the Mailbox that is in the selected state; or null if no Mailbox is selected.

Remarks

Use Select to select a mailbox by absolute path.

Set this property to select a Mailbox, causing the Imap component to send a SELECT command to initialize Mailbox.FirstUnseen Mailbox.Marked, Mailbox.Recent, Mailbox.Selectable, and Mailbox.SublevelsAllowed. The server now considers this Mailbox to be in the "Selected" state and messages can be accessed.

The nature of IMAP is that other clients can delete messages on the server at anytime, so using "foreach" to enumerate the messages in a mailbox is not recommended (unsolicited responses may require the removal of the message from the Mailbox before the enumeration completes). Instead, use "foreach" on SelectedMailbox.ToArray(). If, during this enumeration, a message is deleted by another client, MessageBase.Id will be set to 0, so this value can be checked to ensure the existence of the message before acting upon it.

Methods that access messages will update this property to the containing Mailbox.

Set to null to close the selected mailbox and enter the "Authenticated" state. This action expunges all messages that are marked for deletion.

Example

In this example, the Imap component gets messages from a specified mailbox and saves them to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    //Specify folder to store messages
    string messageFolder = Application.StartupPath + "\\messages";

    //Download all messages in the account and save them to disk
    foreach (ImapMessage imapMessage in imap1.SelectedMailbox.ToArray())
    {
        imapMessage.Get();
        imapMessage.Message.Save(messageFolder + "\\" + imapMessage.Uid + ".eml");
    }

    //Gracefully logout of the session
    imap1.Close();
}

private void imap1_Progress(object sender, ImapProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    'Specify folder to store messages
    Dim messageFolder As String = Application.StartupPath & "\messages"

    'Download all messages in the account and save them to disk
    For Each imapMessage As ImapMessage In imap1.SelectedMailbox.ToArray()
        imapMessage.Get()
        imapMessage.Message.Save(messageFolder & "\" & imapMessage.Uid & ".eml")
    Next imapMessage

    'Gracefully logout of the session
    imap1.Close()
End Sub

Private Sub imap1_Progress(ByVal sender As Object, ByVal e As ImapProgressEventArgs) Handles imap1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Imap Class
Imap Members


Session Property

[image]
PowerTCP Mail for .NET
Session Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : Session Property

Glossary Item Box

Specifies connection, authentication and behavior configuration.

Syntax

Visual Basic (Declaration)
Public Property Session As ImapSession
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim value As ImapSession

instance.Session = value

value = instance.Session
C#
public ImapSession Session {get; set;}
Managed Extensions for C++
public: __property ImapSession* get_Session();
public: __property void set_Session(
   ImapSession* value
);
C++/CLI
public:
property ImapSession^ Session {
   ImapSession^ get();
   void set (    ImapSession^ value);
}

Property Value

ImapSession

Remarks

This class is serializable, and can be used to persist a runtime session configuration.

Example

In this example, the Imap component gets messages from a specified mailbox and saves them to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    //Specify folder to store messages
    string messageFolder = Application.StartupPath + "\\messages";

    //Download all messages in the account and save them to disk
    foreach (ImapMessage imapMessage in imap1.SelectedMailbox.ToArray())
    {
        imapMessage.Get();
        imapMessage.Message.Save(messageFolder + "\\" + imapMessage.Uid + ".eml");
    }

    //Gracefully logout of the session
    imap1.Close();
}

private void imap1_Progress(object sender, ImapProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    'Specify folder to store messages
    Dim messageFolder As String = Application.StartupPath & "\messages"

    'Download all messages in the account and save them to disk
    For Each imapMessage As ImapMessage In imap1.SelectedMailbox.ToArray()
        imapMessage.Get()
        imapMessage.Message.Save(messageFolder & "\" & imapMessage.Uid & ".eml")
    Next imapMessage

    'Gracefully logout of the session
    imap1.Close()
End Sub

Private Sub imap1_Progress(ByVal sender As Object, ByVal e As ImapProgressEventArgs) Handles imap1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Imap Class
Imap Members


Imap Class Events

[image]
PowerTCP Mail for .NET
Imap Class Events
See Also Send comments on this topic
Dart.Mail Namespace : Imap Class

Glossary Item Box

For a list of all members of this type, see Imap members.

Public Events

 | Name | Description
Public Event | Alert | Raised when a response from the server contains an alert message.
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | Progress | Repeatedly raised while a message or message section is retrieved.
Public Event | Update | Raised when unsolicited data is received from the server.
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Imap Class
Dart.Mail Namespace


Alert Event

[image]
PowerTCP Mail for .NET
Alert Event
See Also Send comments on this topic
Dart.Mail Namespace > Imap Class : Alert Event

Glossary Item Box

Raised when a response from the server contains an alert message.

Syntax

Visual Basic (Declaration)
Public Event Alert As EventHandler(Of ImapAlertEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim handler As EventHandler(Of ImapAlertEventArgs)

AddHandler instance.Alert, handler
C#
public event EventHandler<ImapAlertEventArgs> Alert
Managed Extensions for C++
public: __event EventHandler<ImapAlertEventArgs*>* Alert
C++/CLI
public:
event EventHandler<ImapAlertEventArgs^>^ Alert

Event Data

The event handler receives an argument of type ImapAlertEventArgs containing data related to this event. The following ImapAlertEventArgs properties provide information specific to this event.

Property | Description
Message | Contains the text of the message received from the IMAP server.

Remarks

See Also

Reference

Imap Class
Imap Members


Progress Event

[image]
PowerTCP Mail for .NET
Progress Event
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : Progress Event

Glossary Item Box

Repeatedly raised while a message or message section is retrieved.

Syntax

Visual Basic (Declaration)
Public Event Progress As EventHandler(Of ImapProgressEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim handler As EventHandler(Of ImapProgressEventArgs)

AddHandler instance.Progress, handler
C#
public event EventHandler<ImapProgressEventArgs> Progress
Managed Extensions for C++
public: __event EventHandler<ImapProgressEventArgs*>* Progress
C++/CLI
public:
event EventHandler<ImapProgressEventArgs^>^ Progress

Event Data

The event handler receives an argument of type ImapProgressEventArgs containing data related to this event. The following ImapProgressEventArgs properties provide information specific to this event.

Property | Description
Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Message | Gets the ImapMessage being transferred.
Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)

Remarks

Contains data useful for displaying progress to the user.

Example

In this example, the Imap component gets headers for all messages in the INBOX and adds each message's sender, subject and date to a list.
C# Copy Code
private void getMessageHeaders(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Select a mailbox
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];
    //Get headers for all messages in the box
    imap1.SelectedMailbox.Get(imap1.SelectedMailbox.ToArray(), ImapMessageInfo.Header);

    //Gracefully logout of the session
    imap1.Close();
}

private void imap1_Progress(object sender, ImapProgressEventArgs e)
{
    //Display progress in a progress bar
    progressBar1.Value = (int)((e.Position/e.Length)*100);

    //Display message header info in a listview
    if (e.Final)
    {
        progressBar1.Value = 0;
        string[] header = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() };
        listView1.Items.Add(new ListViewItem(header));
    }
}
Visual Basic Copy Code
Private Sub getMessageHeaders(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Select a mailbox
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")
    'Get headers for all messages in the box
    imap1.SelectedMailbox.Get(imap1.SelectedMailbox.ToArray(), ImapMessageInfo.Header)

    'Gracefully logout of the session
    imap1.Close()
End Sub

Private Sub imap1_Progress(ByVal sender As Object, ByVal e As ImapProgressEventArgs) Handles imap1.Progress
    'Display progress in a progress bar
    progressBar1.Value = CInt((e.Position\e.Length)*100)

    'Display message header info in a listview
    If e.Final Then
        progressBar1.Value = 0
        Dim header() As String = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() }
        listView1.Items.Add(New ListViewItem(header))
    End If
End Sub

See Also

Reference

Imap Class
Imap Members


Update Event

[image]
PowerTCP Mail for .NET
Update Event
See Also Example Send comments on this topic
Dart.Mail Namespace > Imap Class : Update Event

Glossary Item Box

Raised when unsolicited data is received from the server.

Syntax

Visual Basic (Declaration)
Public Event Update As EventHandler(Of ImapUpdateEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As Imap
Dim handler As EventHandler(Of ImapUpdateEventArgs)

AddHandler instance.Update, handler
C#
public event EventHandler<ImapUpdateEventArgs> Update
Managed Extensions for C++
public: __event EventHandler<ImapUpdateEventArgs*>* Update
C++/CLI
public:
event EventHandler<ImapUpdateEventArgs^>^ Update

Event Data

The event handler receives an argument of type ImapUpdateEventArgs containing data related to this event. The following ImapUpdateEventArgs properties provide information specific to this event.

Property | Description
Messages | Gets an ImapMessage array that represents the messages affected by the update.
Response | Gets an ImapResponse encapsulating a response from the IMAP server.

Remarks

This event is raised when the number of messages in the selected mailbox has changed.

Example

This example demonstrates use of the Idle method and the Update event.
C# Copy Code
/// <summary>
/// Used here as a stand-in for any collection that should be updated to reflect
/// the current state of messages on the server, such as a ListView.Items collection.
/// </summary>
Dictionary<string, ImapMessage> independentImapMessageCollection = new Dictionary<string, ImapMessage>();

private void button1_Click(object sender, EventArgs e)
{
    //Set server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Start a worker thread
    //This allows the function to execute without blocking the UI
    imap1.Start(listenForUpdates, null);
}

private void button2_Click(object sender, EventArgs e)
{
    //Set server and account info
    smtp1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(mySmtpServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send a message to trigger an exists update.
    smtp1.Send(myEmail, myEmail, "Test Message", "Test Message");
}

private void listenForUpdates(object state)
{
    //This function executes on a worker thread
    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Set the current mailbox to INBOX
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    //Retrieve all messages in the mailbox
    imap1.SelectedMailbox.Get();

    //Add the retrieved messages to the independent collection of ImapMessages
    foreach (ImapMessage message in imap1.SelectedMailbox.ToArray())
        independentImapMessageCollection.Add(message.Uid, message);

    //Initiate Idle to await new updates from server
    imap1.Idle();

    //Idle() returns once the client intiates communication with the server (on a different thread).
    System.Diagnostics.Debug.WriteLine("DONE IDLING");
}

private void imap1_Update(object sender, ImapUpdateEventArgs e)
{
    switch (e.Response.Operation)
    {
        case "EXPUNGE":
            //Remove message(s) from any independently implemented collection
            foreach (ImapMessage msg in e.Messages)
                independentImapMessageCollection.Remove(msg.Uid);
            break;

        case "EXISTS":
            //Retrieve the new messages on a worker thread
            imap1.Start(getMessages, e.Messages);
            break;
    }
}

/// <summary>
/// When the server informs the client of new messages, download the new messages (interrupts IDLE).
/// </summary>
void getMessages(object msgs)
{
    //Executes on a worker thread so UI messages are not interrupted.
    //Cast msgs back to ImapMessage array
    ImapMessage[] messages = msgs as ImapMessage[];

    //Retrieve the new messages from the server. This interrupts IDLE.
    imap1.SelectedMailbox.Get(messages, ImapMessageInfo.Message);

    //Update the independent collection
    foreach (ImapMessage message in messages)
        independentImapMessageCollection.Add(message.Uid, message);

    //Resume Idle to await new updates from server
    imap1.Idle();

    //Idle() returns once the client intiates communication with the server (on a different thread).
    System.Diagnostics.Debug.WriteLine("DONE IDLING");
}
Visual Basic Copy Code
''' <summary>
''' Used here as a stand-in for any collection that should be updated to reflect
''' the current state of messages on the server, such as a ListView.Items collection.
''' </summary>
Private independentImapMessageCollection As New Dictionary(Of String, ImapMessage)()

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    'Set server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Start a worker thread
    'This allows the function to execute without blocking the UI
    imap1.Start(AddressOf listenForUpdates, Nothing)
End Sub

Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click
    'Set server and account info
    smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(mySmtpServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send a message to trigger an exists update.
    smtp1.Send(myEmail, myEmail, "Test Message", "Test Message")
End Sub

Private Sub listenForUpdates(ByVal state As Object)
    'This function executes on a worker thread
    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Set the current mailbox to INBOX
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    'Retrieve all messages in the mailbox
    imap1.SelectedMailbox.Get()

    'Add the retrieved messages to the independent collection of ImapMessages
    For Each message As ImapMessage In imap1.SelectedMailbox.ToArray()
        independentImapMessageCollection.Add(message.Uid, message)
    Next message

    'Initiate Idle to await new updates from server
    imap1.Idle()

    'Idle() returns once the client intiates communication with the server (on a different thread).
    System.Diagnostics.Debug.WriteLine("DONE IDLING")
End Sub

Private Sub imap1_Update(ByVal sender As Object, ByVal e As ImapUpdateEventArgs) Handles imap1.Update
    Select Case e.Response.Operation
        Case "EXPUNGE"
            'Remove message(s) from any independently implemented collection
            For Each msg As ImapMessage In e.Messages
                independentImapMessageCollection.Remove(msg.Uid)
            Next msg

        Case "EXISTS"
            'Retrieve the new messages on a worker thread
            imap1.Start(AddressOf getMessages, e.Messages)
    End Select
End Sub

''' <summary>
''' When the server informs the client of new messages, download the new messages (interrupts IDLE).
''' </summary>
Private Sub getMessages(ByVal msgs As Object)
    'Executes on a worker thread so UI messages are not interrupted.
    'Cast msgs back to ImapMessage array
    Dim messages() As ImapMessage = TryCast(msgs, ImapMessage())

    'Retrieve the new messages from the server. This interrupts IDLE.
    imap1.SelectedMailbox.Get(messages, ImapMessageInfo.Message)

    'Update the independent collection
    For Each message As ImapMessage In messages
        independentImapMessageCollection.Add(message.Uid, message)
    Next message

    'Resume Idle to await new updates from server
    imap1.Idle()

    'Idle() returns once the client intiates communication with the server (on a different thread).
    System.Diagnostics.Debug.WriteLine("DONE IDLING")
End Sub

See Also

Reference

Imap Class
Imap Members


ImapAlertEventArgs Class

[image]
PowerTCP Mail for .NET
ImapAlertEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ImapAlertEventArgs Class

Glossary Item Box

Provides data for the Imap.Alert event.

Object Model

ImapAlertEventArgs Class

Syntax

Visual Basic (Declaration)
Public Class ImapAlertEventArgs
   Inherits System.EventArgs
Visual Basic (Usage) Copy Code
Dim instance As ImapAlertEventArgs
C#
public class ImapAlertEventArgs : System.EventArgs
Managed Extensions for C++
public __gc class ImapAlertEventArgs : public System.EventArgs
C++/CLI
public ref class ImapAlertEventArgs : public System.EventArgs

Remarks

Message represents the text of the message received from the IMAP server.

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.ImapAlertEventArgs

See Also

Reference

ImapAlertEventArgs Members
Dart.Mail Namespace


ImapAlertEventArgs Class Members

[image]
PowerTCP Mail for .NET
ImapAlertEventArgs Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : ImapAlertEventArgs Class

Glossary Item Box

The following tables list the members exposed by ImapAlertEventArgs.

Public Properties

 | Name | Description
Public Property | Message | Contains the text of the message received from the IMAP server.
Top

See Also

Reference

ImapAlertEventArgs Class
Dart.Mail Namespace


ImapAlertEventArgs Class Properties

[image]
PowerTCP Mail for .NET
ImapAlertEventArgs Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ImapAlertEventArgs Class

Glossary Item Box

For a list of all members of this type, see ImapAlertEventArgs members.

Public Properties

 | Name | Description
Public Property | Message | Contains the text of the message received from the IMAP server.
Top

See Also

Reference

ImapAlertEventArgs Class
Dart.Mail Namespace


Message Property

[image]
PowerTCP Mail for .NET
Message Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapAlertEventArgs Class : Message Property

Glossary Item Box

Contains the text of the message received from the IMAP server.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Message As String
Visual Basic (Usage) Copy Code
Dim instance As ImapAlertEventArgs
Dim value As String

value = instance.Message
C#
public string Message {get;}
Managed Extensions for C++
public: __property string* get_Message();
C++/CLI
public:
property String^ Message {
   String^ get();
}

Property Value

Returns a string that contains the text of the message received from the IMAP server.

See Also

Reference

ImapAlertEventArgs Class
ImapAlertEventArgs Members


ImapMessage Class

[image]
PowerTCP Mail for .NET
ImapMessage Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ImapMessage Class

Glossary Item Box

Represents a message the IMAP server is managing.

Object Model

ImapMessage ClassMailbox ClassImapMessage ClassMailMessage Class

Syntax

Visual Basic (Declaration)
Public Class ImapMessage
   Inherits MessageBase
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
C#
public class ImapMessage : MessageBase
Managed Extensions for C++
public __gc class ImapMessage : public MessageBase
C++/CLI
public ref class ImapMessage : public MessageBase

Inheritance Hierarchy

System.Object
Dart.Mail.MessageBase
Dart.Mail.ImapMessage

See Also

Reference

ImapMessage Members
Dart.Mail Namespace


ImapMessage Class Members

[image]
PowerTCP Mail for .NET
ImapMessage Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : ImapMessage Class

Glossary Item Box

The following tables list the members exposed by ImapMessage.

Public Properties

 | Name | Description
Public Property | Answered | Returns the value of the Answered flag on the server. Use Update to modify its value.
Public Property | Date | Gets the internal date of the message.
Public Property | Deleted | Returns the value of the Delete flag on the server. Use Update to modify its value.
Public Property | Draft | Returns the value of the Draft flag on the server. Use Update to modify its value.
Public Property | Flagged | Returns the value of the Flagged flag on the server. Use Update to modify its value.
Public Property | Id | Returns the Id of the message. (Inherited from Dart.Mail.MessageBase)
Public Property | Info | Gets the ImapMessageInfo sections used by the Imap FETCH command.
Public Property | Mailbox | Gets the mailbox containing the message.
Public Property | Message | Used for referencing the downloaded MailMessage. (Inherited from Dart.Mail.MessageBase)
Public Property | Recent | Returns the value of the Recent flag on the server.
Public Property | Seen | Returns the value of the Seen flag on the server. Use Update to modify its value.
Public Property | Size | The size of the message in bytes. (Inherited from Dart.Mail.MessageBase)
Public Property | Tag | Gets or sets an object reference that can be used to associate this instance with any other object. (Inherited from Dart.Mail.MessageBase)
Public Property | Uid | Returns the unique identifier of the message. (Inherited from Dart.Mail.MessageBase)
Top

Public Methods

 | Name | Description
Public Method | CopyTo | Copy the message to another mailbox.
Public Method | Get | Overloaded. Gets the message.
Public Method | GetPart | Gets a single part of a message.
Public Method | Update | Updates the specified flag value on the server.
Top

See Also

Reference

ImapMessage Class
Dart.Mail Namespace


ImapMessage Class Methods

[image]
PowerTCP Mail for .NET
ImapMessage Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ImapMessage Class

Glossary Item Box

For a list of all members of this type, see ImapMessage members.

Public Methods

 | Name | Description
Public Method | CopyTo | Copy the message to another mailbox.
Public Method | Get | Overloaded. Gets the message.
Public Method | GetPart | Gets a single part of a message.
Public Method | Update | Updates the specified flag value on the server.
Top

See Also

Reference

ImapMessage Class
Dart.Mail Namespace


CopyTo Method

[image]
PowerTCP Mail for .NET
CopyTo Method
See Also Example Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : CopyTo Method

destination
The name of the destination mailbox.

Glossary Item Box

Copy the message to another mailbox.

Syntax

Visual Basic (Declaration)
Public Sub CopyTo( _
   ByVal destination As Mailbox _
)
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim destination As Mailbox

instance.CopyTo(destination)
C#
public void CopyTo(
   Mailbox destination
)
Managed Extensions for C++
public: void CopyTo(
   Mailbox* destination
)
C++/CLI
public:
void CopyTo(
   Mailbox^ destination
)

Parameters

destination
The name of the destination mailbox.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

This method copies the message to the specified mailbox with the IMAP COPY command.

Example

In this example, the Imap component copies messages that match a specified criteria to another mailbox.
C# Copy Code
private void getMessages(object state)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Set the selected mailbox to the Inbox
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    // Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON"
    ImapSearchParameter[] criteria = new ImapSearchParameter[]
    {
        new ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"),
        new ImapSearchParameter(ImapCriterion.Not, ""),
        new ImapSearchParameter(ImapCriterion.From, "JACKSON")
    };

    // Perform the search
    ImapMessage[] messages = imap1.SelectedMailbox.Search(criteria);

    //Copy all messages that meet the criteria to the 'Save' mailbox
    foreach (ImapMessage imapMessage in messages)
        imapMessage.CopyTo(imap1.Mailboxes["Save"]);

    //Gracefully logout
    imap1.Close();
}
Visual Basic Copy Code
Private Sub getMessages(ByVal state As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Set the selected mailbox to the Inbox
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    ' Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON"
    Dim criteria() As ImapSearchParameter = { New ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"), New ImapSearchParameter(ImapCriterion.Not, ""), New ImapSearchParameter(ImapCriterion.From, "JACKSON") }

    ' Perform the search
    Dim messages() As ImapMessage = imap1.SelectedMailbox.Search(criteria)

    'Copy all messages that meet the criteria to the 'Save' mailbox
    For Each imapMessage As ImapMessage In messages
        imapMessage.CopyTo(imap1.Mailboxes("Save"))
    Next imapMessage

    'Gracefully logout
    imap1.Close()
End Sub

See Also

Reference

ImapMessage Class
ImapMessage Members


Get Method

[image]
PowerTCP Mail for .NET
Get Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Get Method

Glossary Item Box

Gets the message.

Overload List

Overload | Description
Get() | Gets the message.
Get(ImapMessageInfo) | Gets the specified message sections.
Get(Stream,ImapMessageInfo) | Gets the specified message sections of the encoded message and writes it to the specified Stream without decoding.

See Also

Reference

ImapMessage Class
ImapMessage Members


Get() Method

[image]
PowerTCP Mail for .NET
Get() Method
See Also Example Send comments on this topic
Dart.Mail Namespace > ImapMessage Class > Get Method : Get() Method

Glossary Item Box

Gets the message.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Get()
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage

instance.Get()
C#
public void Get()
Managed Extensions for C++
public: void Get();
C++/CLI
public:
void Get();

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

Gets a single message, including flags, internal date and UID and populates MessageBase.Message. Use Mailbox.Get to get all messages in a mailbox.

Example

This example demonstrates two methods of downloading all emails in the current mailbox, and saving them to disk.
C# Copy Code
/// <summary>
/// Downloads each message in the current mailbox and saves it to the specified directory.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
/// <param name="downloadFolder">The directory to save the emails in.</param>
public void GetMessagesInterleaved(Imap myImap, string downloadFolder)
{
    foreach (ImapMessage message in myImap.SelectedMailbox.ToArray())
    {
        //Confirm that the message in the copied array wasn't deleted by another client
        if (message.Id != 0)
        {
            message.Get();
            message.Message.Save(Path.Combine(downloadFolder, message.Uid + ".eml"));
        }
    }
}

/// <summary>
/// Downloads all messages in the current mailbox and then saves them to the specified directory.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
/// <param name="downloadFolder">The directory to save the emails in.</param>
public void GetMessages(Imap myImap, string downloadFolder)
{
    ImapMessage[] messages = myImap.SelectedMailbox.Get();
    foreach (ImapMessage message in messages)
        message.Message.Save(Path.Combine(downloadFolder, message.Uid + ".eml"));
}
Visual Basic Copy Code
''' <summary>
''' Downloads each message in the current mailbox and saves it to the specified directory.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
''' <param name="downloadFolder">The directory to save the emails in.</param>
Public Sub GetMessagesInterleaved(ByVal myImap As Imap, ByVal downloadFolder As String)
    For Each message As ImapMessage In myImap.SelectedMailbox.ToArray()
        'Confirm that the message in the copied array wasn't deleted by another client
        If message.Id <> 0 Then
            message.Get()
            message.Message.Save(Path.Combine(downloadFolder, message.Uid & ".eml"))
        End If
    Next message
End Sub

''' <summary>
''' Downloads all messages in the current mailbox and then saves them to the specified directory.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
''' <param name="downloadFolder">The directory to save the emails in.</param>
Public Sub GetMessages(ByVal myImap As Imap, ByVal downloadFolder As String)
    Dim messages() As ImapMessage = myImap.SelectedMailbox.Get()
    For Each message As ImapMessage In messages
        message.Message.Save(Path.Combine(downloadFolder, message.Uid & ".eml"))
    Next message
End Sub

See Also

Reference

ImapMessage Class
ImapMessage Members
Overload List


Get(ImapMessageInfo) Method

[image]
PowerTCP Mail for .NET
Get(ImapMessageInfo) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > ImapMessage Class > Get Method : Get(ImapMessageInfo) Method

sections
Message sections to update.

Glossary Item Box

Gets the specified message sections.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Get( _
   ByVal sections As ImapMessageInfo _
)
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim sections As ImapMessageInfo

instance.Get(sections)
C#
public void Get(
   ImapMessageInfo sections
)
Managed Extensions for C++
public: void Get(
   ImapMessageInfo sections
)
C++/CLI
public:
void Get(
   ImapMessageInfo sections
)

Parameters

sections
Message sections to update.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

A combination of of ImapMessageInfo can be used to selectively populate MessageBase.Message.

For example, ImapMessageInfo.Structure can be used to populate Message with parts that have no data. GetPart can subsequently be used to get data for any Part in Parts.

Example

This example demonstrates how to download the attachments of a message, without downloading the entire message.
C# Copy Code
/// <summary>
/// Downloads all attachments from the first email that contains attachments.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
/// <param name="saveDir">Path of the directory to save the attachments in.</param>
public void GetMessageAttachments(Imap myImap, string saveDir)
{
    //Discover attachments by retrieving email BodyStructure,
    //then download the attachments using GetPart()
    foreach (ImapMessage imapMessage in myImap.SelectedMailbox.ToArray())
    {
        imapMessage.Get(ImapMessageInfo.Structure);
        if (imapMessage.Message.Attachments.Count > 0)
        {
            foreach (Attachment attachment in imapMessage.Message.Attachments)
            {
                imapMessage.GetPart(attachment, false);
                attachment.Content.MoveTo(Path.Combine(saveDir, attachment.FileName));
            }
            break;
        }
    }
}
Visual Basic Copy Code
''' <summary>
''' Downloads all attachments from the first email that contains attachments.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
''' <param name="saveDir">Path of the directory to save the attachments in.</param>
Public Sub GetMessageAttachments(ByVal myImap As Imap, ByVal saveDir As String)
    'Discover attachments by retrieving email BodyStructure,
    'then download the attachments using GetPart()
    For Each imapMessage As ImapMessage In myImap.SelectedMailbox.ToArray()
        imapMessage.Get(ImapMessageInfo.Structure)
        If imapMessage.Message.Attachments.Count > 0 Then
            For Each attachment As Attachment In imapMessage.Message.Attachments
                imapMessage.GetPart(attachment, False)
                attachment.Content.MoveTo(Path.Combine(saveDir, attachment.FileName))
            Next attachment
            Exit For
        End If
    Next imapMessage
End Sub

See Also

Reference

ImapMessage Class
ImapMessage Members
Overload List


Get(Stream,ImapMessageInfo) Method

[image]
PowerTCP Mail for .NET
Get(Stream,ImapMessageInfo) Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class > Get Method : Get(Stream,ImapMessageInfo) Method

destination
Stream to be written to.
sections
Message sections to get.

Glossary Item Box

Gets the specified message sections of the encoded message and writes it to the specified Stream without decoding.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Get( _
   ByVal destination As Stream, _
   ByVal sections As ImapMessageInfo _
)
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim destination As Stream
Dim sections As ImapMessageInfo

instance.Get(destination, sections)
C#
public void Get(
   Stream destination,
   ImapMessageInfo sections
)
Managed Extensions for C++
public: void Get(
   Stream* destination,
   ImapMessageInfo sections
)
C++/CLI
public:
void Get(
   Stream^ destination,
   ImapMessageInfo sections
)

Parameters

destination
Stream to be written to.
sections
Message sections to get.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.

Remarks

A combination of of ImapMessageInfo can be used to specify data of interest. For example, ImapMessageInfo.Header can be used to retrieve the message header.

This method will set Info as applicable for the value of sections.

See Also

Reference

ImapMessage Class
ImapMessage Members
Overload List


GetPart Method

[image]
PowerTCP Mail for .NET
GetPart Method
See Also Example Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : GetPart Method

part
The message part to retrieve.
peek
Use true if the message Seen flag should not be set to true.

Glossary Item Box

Gets a single part of a message.

Syntax

Visual Basic (Declaration)
Public Function GetPart( _
   ByVal part As Part, _
   ByVal peek As Boolean _
) As Stream
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim part As Part
Dim peek As Boolean
Dim value As Stream

value = instance.GetPart(part, peek)
C#
public Stream GetPart(
   Part part,
   bool peek
)
Managed Extensions for C++
public: Stream* GetPart(
   Part* part,
   bool peek
)
C++/CLI
public:
Stream^ GetPart(
   Part^ part,
   bool peek
)

Parameters

part
The message part to retrieve.
peek
Use true if the message Seen flag should not be set to true.

Return Value

A Stream containing the part data.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

This method gets a single part of a message. part must be from the MailMessage.Content collection. This method can be used to download a message attachment without retrieving the entire message.

Typically, ImapMessage.Get(ImapMessageInfo.Structure) is called prior to this method to create a MailMessage with a Content collection containing empty Part objects. One of these parts is passed to this method.

peek indicates whether this operation should mark the message as seen; if peek is true, the Seen flag is not changed. If peek is false, the Seen flag is set to true.

Example

This example demonstrates how to download the attachments of a message, without downloading the entire message.
C# Copy Code
/// <summary>
/// Downloads all attachments from the first email that contains attachments.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
/// <param name="saveDir">Path of the directory to save the attachments in.</param>
public void GetMessageAttachments(Imap myImap, string saveDir)
{
    //Discover attachments by retrieving email BodyStructure,
    //then download the attachments using GetPart()
    foreach (ImapMessage imapMessage in myImap.SelectedMailbox.ToArray())
    {
        imapMessage.Get(ImapMessageInfo.Structure);
        if (imapMessage.Message.Attachments.Count > 0)
        {
            foreach (Attachment attachment in imapMessage.Message.Attachments)
            {
                imapMessage.GetPart(attachment, false);
                attachment.Content.MoveTo(Path.Combine(saveDir, attachment.FileName));
            }
            break;
        }
    }
}
Visual Basic Copy Code
''' <summary>
''' Downloads all attachments from the first email that contains attachments.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
''' <param name="saveDir">Path of the directory to save the attachments in.</param>
Public Sub GetMessageAttachments(ByVal myImap As Imap, ByVal saveDir As String)
    'Discover attachments by retrieving email BodyStructure,
    'then download the attachments using GetPart()
    For Each imapMessage As ImapMessage In myImap.SelectedMailbox.ToArray()
        imapMessage.Get(ImapMessageInfo.Structure)
        If imapMessage.Message.Attachments.Count > 0 Then
            For Each attachment As Attachment In imapMessage.Message.Attachments
                imapMessage.GetPart(attachment, False)
                attachment.Content.MoveTo(Path.Combine(saveDir, attachment.FileName))
            Next attachment
            Exit For
        End If
    Next imapMessage
End Sub

See Also

Reference

ImapMessage Class
ImapMessage Members


Update Method

[image]
PowerTCP Mail for .NET
Update Method
See Also Example Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Update Method

set
Use true to add the flags and false to remove them.
flags
ImapFlags value specifying the flag(s) to modify.

Glossary Item Box

Updates the specified flag value on the server.

Syntax

Visual Basic (Declaration)
Public Function Update( _
   ByVal set As Boolean, _
   ByVal flags As ImapFlags _
) As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim set As Boolean
Dim flags As ImapFlags
Dim value As ImapResponse

value = instance.Update(set, flags)
C#
public ImapResponse Update(
   bool set,
   ImapFlags flags
)
Managed Extensions for C++
public: ImapResponse* Update(
   bool set,
   ImapFlags flags
)
C++/CLI
public:
ImapResponse^ Update(
   bool set,
   ImapFlags flags
)

Parameters

set
Use true to add the flags and false to remove them.
flags
ImapFlags value specifying the flag(s) to modify.

Remarks

Use the Mailbox.Update() methods to modify flags on sets of messages.

Example

This example demonstrates setting the delete flag on one message on an Imap server.
C# Copy Code
/// <summary>
/// Sets the delete flag for the specified email. Email will be deleted by calling
/// Mailbox.Purge(), or upon logout.
/// </summary>
/// <param name="message">Message to set the delete flag for.</param>
public void DeleteMessage(ImapMessage message)
{
    message.Update(true, ImapFlags.Deleted);
}
Visual Basic Copy Code
''' <summary>
''' Sets the delete flag for the specified email. Email will be deleted by calling
''' Mailbox.Purge(), or upon logout.
''' </summary>
''' <param name="message">Message to set the delete flag for.</param>
Public Sub DeleteMessage(ByVal message As ImapMessage)
    message.Update(True, ImapFlags.Deleted)
End Sub

See Also

Reference

ImapMessage Class
ImapMessage Members


ImapMessage Class Properties

[image]
PowerTCP Mail for .NET
ImapMessage Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ImapMessage Class

Glossary Item Box

For a list of all members of this type, see ImapMessage members.

Public Properties

 | Name | Description
Public Property | Answered | Returns the value of the Answered flag on the server. Use Update to modify its value.
Public Property | Date | Gets the internal date of the message.
Public Property | Deleted | Returns the value of the Delete flag on the server. Use Update to modify its value.
Public Property | Draft | Returns the value of the Draft flag on the server. Use Update to modify its value.
Public Property | Flagged | Returns the value of the Flagged flag on the server. Use Update to modify its value.
Public Property | Id | Returns the Id of the message. (Inherited from Dart.Mail.MessageBase)
Public Property | Info | Gets the ImapMessageInfo sections used by the Imap FETCH command.
Public Property | Mailbox | Gets the mailbox containing the message.
Public Property | Message | Used for referencing the downloaded MailMessage. (Inherited from Dart.Mail.MessageBase)
Public Property | Recent | Returns the value of the Recent flag on the server.
Public Property | Seen | Returns the value of the Seen flag on the server. Use Update to modify its value.
Public Property | Size | The size of the message in bytes. (Inherited from Dart.Mail.MessageBase)
Public Property | Tag | Gets or sets an object reference that can be used to associate this instance with any other object. (Inherited from Dart.Mail.MessageBase)
Public Property | Uid | Returns the unique identifier of the message. (Inherited from Dart.Mail.MessageBase)
Top

See Also

Reference

ImapMessage Class
Dart.Mail Namespace


Answered Property

[image]
PowerTCP Mail for .NET
Answered Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Answered Property

Glossary Item Box

Returns the value of the Answered flag on the server. Use Update to modify its value.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Answered As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As Boolean

value = instance.Answered
C#
public bool Answered {get;}
Managed Extensions for C++
public: __property bool get_Answered();
C++/CLI
public:
property bool Answered {
   bool get();
}

Property Value

True if the Answered flag is set; otherwise false.

Remarks

Returns true if the current message has been answered (server-side flag \Answered). This property is controlled by the client, not the server (the server does not decide when a message has been answered).

Use the Mailbox.Update() methods to modify flags on sets of messages.

Returns a default value if its value has not been populated with Get.

See Also

Reference

ImapMessage Class
ImapMessage Members


Date Property

[image]
PowerTCP Mail for .NET
Date Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Date Property

Glossary Item Box

Gets the internal date of the message.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Date As Date
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As Date

value = instance.Date
C#
public DateTime Date {get;}
Managed Extensions for C++
public: __property DateTime get_Date();
C++/CLI
public:
property DateTime Date {
   DateTime get();
}

Property Value

A DateTime representation of the message's internal date.

Remarks

Returns the date when the server received the message. This is independent of the Date header, which typically indicates the date the message was sent.

Returns a default DateTime value if its value has not been populated with Get.

See Also

Reference

ImapMessage Class
ImapMessage Members


Deleted Property

[image]
PowerTCP Mail for .NET
Deleted Property
See Also Example Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Deleted Property

Glossary Item Box

Returns the value of the Delete flag on the server. Use Update to modify its value.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Deleted As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As Boolean

value = instance.Deleted
C#
public bool Deleted {get;}
Managed Extensions for C++
public: __property bool get_Deleted();
C++/CLI
public:
property bool Deleted {
   bool get();
}

Property Value

True if the message has been marked for deletion, false otherwise. The default value is false.

Remarks

Marked messages are expunged when Mailbox.Purge is called, SelectedMailbox is set to null, or Close is used.

Use the Mailbox.Update() methods to modify flags on sets of messages.

Returns a default value if its value has not been populated with Get.

Example

This example demonstrates setting the delete flag on one message on an Imap server.
C# Copy Code
/// <summary>
/// Sets the delete flag for the specified email. Email will be deleted by calling
/// Mailbox.Purge(), or upon logout.
/// </summary>
/// <param name="message">Message to set the delete flag for.</param>
public void DeleteMessage(ImapMessage message)
{
    message.Update(true, ImapFlags.Deleted);
}
Visual Basic Copy Code
''' <summary>
''' Sets the delete flag for the specified email. Email will be deleted by calling
''' Mailbox.Purge(), or upon logout.
''' </summary>
''' <param name="message">Message to set the delete flag for.</param>
Public Sub DeleteMessage(ByVal message As ImapMessage)
    message.Update(True, ImapFlags.Deleted)
End Sub

See Also

Reference

ImapMessage Class
ImapMessage Members


Draft Property

[image]
PowerTCP Mail for .NET
Draft Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Draft Property

Glossary Item Box

Returns the value of the Draft flag on the server. Use Update to modify its value.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Draft As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As Boolean

value = instance.Draft
C#
public bool Draft {get;}
Managed Extensions for C++
public: __property bool get_Draft();
C++/CLI
public:
property bool Draft {
   bool get();
}

Property Value

True if the Draft flag is set; otherwise false.

Remarks

Returns true if the current message has an incomplete composition (server-side flag \Draft). This property is controlled by the client, not the server (the server does not decide when composition is complete).

Use the Mailbox.Update() methods to modify flags on sets of messages.

Returns a default value if its value has not been populated with Get.

See Also

Reference

ImapMessage Class
ImapMessage Members


Flagged Property

[image]
PowerTCP Mail for .NET
Flagged Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Flagged Property

Glossary Item Box

Returns the value of the Flagged flag on the server. Use Update to modify its value.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Flagged As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As Boolean

value = instance.Flagged
C#
public bool Flagged {get;}
Managed Extensions for C++
public: __property bool get_Flagged();
C++/CLI
public:
property bool Flagged {
   bool get();
}

Property Value

True if the Flagged flag is set; otherwise false.

Remarks

Returns true if the current message has been flagged for urgent or special attention (server-side flag \Flagged). This property is controlled by the client, not the server (the server does not decide when messages deserve attention).

Use the Mailbox.Update() methods to modify flags on sets of messages.

Returns a default value if its value has not been populated with Get.

See Also

Reference

ImapMessage Class
ImapMessage Members


Info Property

[image]
PowerTCP Mail for .NET
Info Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Info Property

Glossary Item Box

Gets the ImapMessageInfo sections used by the Imap FETCH command.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Info As ImapMessageInfo
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As ImapMessageInfo

value = instance.Info
C#
public ImapMessageInfo Info {get;}
Managed Extensions for C++
public: __property ImapMessageInfo get_Info();
C++/CLI
public:
property ImapMessageInfo Info {
   ImapMessageInfo get();
}

See Also

Reference

ImapMessage Class
ImapMessage Members


Mailbox Property

[image]
PowerTCP Mail for .NET
Mailbox Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Mailbox Property

Glossary Item Box

Gets the mailbox containing the message.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Mailbox As Mailbox
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As Mailbox

value = instance.Mailbox
C#
public Mailbox Mailbox {get;}
Managed Extensions for C++
public: __property Mailbox* get_Mailbox();
C++/CLI
public:
property Mailbox^ Mailbox {
   Mailbox^ get();
}

Property Value

A Mailbox containing this message.

See Also

Reference

ImapMessage Class
ImapMessage Members


Recent Property

[image]
PowerTCP Mail for .NET
Recent Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Recent Property

Glossary Item Box

Returns the value of the Recent flag on the server.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Recent As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As Boolean

value = instance.Recent
C#
public bool Recent {get;}
Managed Extensions for C++
public: __property bool get_Recent();
C++/CLI
public:
property bool Recent {
   bool get();
}

Property Value

True if the Recent flag is set; otherwise false.

Remarks

Returns true if the current message has arrived recently in the mailbox (server-side flag \Recent). This property is controlled by the server, not the client, and the definition of "recent" may vary according to server implementation.

Returns a default value if its value has not been populated with Get.

See Also

Reference

ImapMessage Class
ImapMessage Members


Seen Property

[image]
PowerTCP Mail for .NET
Seen Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapMessage Class : Seen Property

Glossary Item Box

Returns the value of the Seen flag on the server. Use Update to modify its value.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Seen As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ImapMessage
Dim value As Boolean

value = instance.Seen
C#
public bool Seen {get;}
Managed Extensions for C++
public: __property bool get_Seen();
C++/CLI
public:
property bool Seen {
   bool get();
}

Property Value

True if the Seen flag is set; otherise false.

Remarks

Returns true if the server includes a \Seen flag in its response to an IMAP FETCH command, or when retrieving ImapMessageInfo.Message or ImapMessageInfo.Text without ImapMessageInfo.Flags. This property may be modified by the client or the server.

Use the Mailbox.Update() methods to modify flags on sets of messages.

Returns a default value (false) if its value has not been populated with Get.

See Also

Reference

ImapMessage Class
ImapMessage Members


ImapProgressEventArgs Class

[image]
PowerTCP Mail for .NET
ImapProgressEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ImapProgressEventArgs Class

Glossary Item Box

Provides data for Imap.Progress.

Object Model

ImapProgressEventArgs ClassImapMessage Class

Syntax

Visual Basic (Declaration)
Public Class ImapProgressEventArgs
   Inherits ProgressEventArgs
Visual Basic (Usage) Copy Code
Dim instance As ImapProgressEventArgs
C#
public class ImapProgressEventArgs : ProgressEventArgs
Managed Extensions for C++
public __gc class ImapProgressEventArgs : public ProgressEventArgs
C++/CLI
public ref class ImapProgressEventArgs : public ProgressEventArgs

Remarks

Provides data for the Progress event, which is periodically raised while a message or message section is transferred. Message represents the message being transferred.

ProgressEventArgs.Length and ProgressEventArgs.Position depend on the operation:

  • When downloading headers, Length is the total length of the headers. Position is the count of bytes received.
  • When downloading messages, Length is the total length of the message. Position is the count of bytes received.
  • When downloading body structure or envelope, Length and Position are 0.

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.ProgressEventArgs
Dart.Mail.ImapProgressEventArgs

See Also

Reference

ImapProgressEventArgs Members
Dart.Mail Namespace


ImapProgressEventArgs Class Members

[image]
PowerTCP Mail for .NET
ImapProgressEventArgs Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : ImapProgressEventArgs Class

Glossary Item Box

The following tables list the members exposed by ImapProgressEventArgs.

Public Properties

 | Name | Description
Public Property | Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Message | Gets the ImapMessage being transferred.
Public Property | Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Top

See Also

Reference

ImapProgressEventArgs Class
Dart.Mail Namespace


ImapProgressEventArgs Class Properties

[image]
PowerTCP Mail for .NET
ImapProgressEventArgs Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ImapProgressEventArgs Class

Glossary Item Box

For a list of all members of this type, see ImapProgressEventArgs members.

Public Properties

 | Name | Description
Public Property | Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Message | Gets the ImapMessage being transferred.
Public Property | Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Top

See Also

Reference

ImapProgressEventArgs Class
Dart.Mail Namespace


Message Property

[image]
PowerTCP Mail for .NET
Message Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapProgressEventArgs Class : Message Property

Glossary Item Box

Gets the ImapMessage being transferred.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Message As ImapMessage
Visual Basic (Usage) Copy Code
Dim instance As ImapProgressEventArgs
Dim value As ImapMessage

value = instance.Message
C#
public ImapMessage Message {get;}
Managed Extensions for C++
public: __property ImapMessage* get_Message();
C++/CLI
public:
property ImapMessage^ Message {
   ImapMessage^ get();
}

Property Value

Returns the ImapMessage that represents the message being transferred.

See Also

Reference

ImapProgressEventArgs Class
ImapProgressEventArgs Members


ImapResponse Class

[image]
PowerTCP Mail for .NET
ImapResponse Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ImapResponse Class

Glossary Item Box

Represents a single line response from an IMAP server.

Object Model

ImapResponse Class

Syntax

Visual Basic (Declaration)
Public Class ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
C#
public class ImapResponse
Managed Extensions for C++
public __gc class ImapResponse
C++/CLI
public ref class ImapResponse

Remarks

An IMAP server response may be received as a reply to a command, or may be received unprovoked.

For example, upon receiving the following line,

            * OK [UIDVALIDITY 1032904889] UIDs valid

the properties of this object would be:

Property | Value
ImapResponse.Code | ImapCode.UidValidity
ImapResponse.CodeValue | "1032904889"
ImapResponse.Explanation | "UIDs valid"
ImapResponse.Operation | ""
ImapResponse.Status | ImapStatus.Ok
ImapResponse.Tag | "*"
ImapResponse.Value | ""

Inheritance Hierarchy

System.Object
Dart.Mail.ImapResponse

See Also

Reference

ImapResponse Members
Dart.Mail Namespace


ImapResponse Class Members

[image]
PowerTCP Mail for .NET
ImapResponse Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : ImapResponse Class

Glossary Item Box

The following tables list the members exposed by ImapResponse.

Public Properties

 | Name | Description
Public Property | Code | Gets the response code.
Public Property | CodeValue | Gets additional text returned with the response code.
Public Property | Explanation | Gets explanation text sent by the server.
Public Property | Operation | Gets the response action.
Public Property | Status | Gets the status of the response.
Public Property | Tag | Gets the unique identifier for the command.
Public Property | Value | Gets the first value/token of the response.
Top

Public Methods

 | Name | Description
Public Method | ToString | Returns the entire response line.
Top

See Also

Reference

ImapResponse Class
Dart.Mail Namespace


ImapResponse Class Methods

[image]
PowerTCP Mail for .NET
ImapResponse Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ImapResponse Class

Glossary Item Box

For a list of all members of this type, see ImapResponse members.

Public Methods

 | Name | Description
Public Method | ToString | Returns the entire response line.
Top

See Also

Reference

ImapResponse Class
Dart.Mail Namespace


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapResponse Class : ToString Method

Glossary Item Box

Returns the entire response line.

Syntax

Visual Basic (Declaration)
Public Overrides Function ToString() As String
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
Dim value As String

value = instance.ToString()
C#
public override string ToString()
Managed Extensions for C++
public: string* ToString(); override
C++/CLI
public:
String^ ToString(); override

Return Value

A string representation of the entire response line.

See Also

Reference

ImapResponse Class
ImapResponse Members


ImapResponse Class Properties

[image]
PowerTCP Mail for .NET
ImapResponse Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ImapResponse Class

Glossary Item Box

For a list of all members of this type, see ImapResponse members.

Public Properties

 | Name | Description
Public Property | Code | Gets the response code.
Public Property | CodeValue | Gets additional text returned with the response code.
Public Property | Explanation | Gets explanation text sent by the server.
Public Property | Operation | Gets the response action.
Public Property | Status | Gets the status of the response.
Public Property | Tag | Gets the unique identifier for the command.
Public Property | Value | Gets the first value/token of the response.
Top

See Also

Reference

ImapResponse Class
Dart.Mail Namespace


Code Property

[image]
PowerTCP Mail for .NET
Code Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapResponse Class : Code Property

Glossary Item Box

Gets the response code.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Code As ImapCode
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
Dim value As ImapCode

value = instance.Code
C#
public ImapCode Code {get;}
Managed Extensions for C++
public: __property ImapCode get_Code();
C++/CLI
public:
property ImapCode Code {
   ImapCode get();
}

Property Value

An ImapCode describing the received code. ImapCode.None if no code is present.

Remarks

This property returns the optional line response code. For example, the value is ImapCode.UidValidity for the line below.

            * OK [UIDVALIDITY 1032904889] UIDs valid

See the ImapCode enumeration for possible code values.

See Also

Reference

ImapResponse Class
ImapResponse Members


CodeValue Property

[image]
PowerTCP Mail for .NET
CodeValue Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapResponse Class : CodeValue Property

Glossary Item Box

Gets additional text returned with the response code.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property CodeValue As String
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
Dim value As String

value = instance.CodeValue
C#
public string CodeValue {get;}
Managed Extensions for C++
public: __property string* get_CodeValue();
C++/CLI
public:
property String^ CodeValue {
   String^ get();
}

Property Value

A string containing the response code additional text.

Remarks

This property returns any additional text returned with the response code. Typically, this optional text contains the "value" for the code.

For example, the value is "1032904889" for the line below.

            * OK [UIDVALIDITY 1032904889] UIDs valid

See Also

Reference

ImapResponse Class
ImapResponse Members


Explanation Property

[image]
PowerTCP Mail for .NET
Explanation Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapResponse Class : Explanation Property

Glossary Item Box

Gets explanation text sent by the server.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Explanation As String
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
Dim value As String

value = instance.Explanation
C#
public string Explanation {get;}
Managed Extensions for C++
public: __property string* get_Explanation();
C++/CLI
public:
property String^ Explanation {
   String^ get();
}

Property Value

A string containing any explanatory text in the response.

Remarks

This property returns optional explanatory information text sent by the server. For example, the value is "UIDs valid" for the line below.

            * OK [UIDVALIDITY 1032904889] UIDs valid

See Also

Reference

ImapResponse Class
ImapResponse Members


Operation Property

[image]
PowerTCP Mail for .NET
Operation Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapResponse Class : Operation Property

Glossary Item Box

Gets the response action.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Operation As String
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
Dim value As String

value = instance.Operation
C#
public string Operation {get;}
Managed Extensions for C++
public: __property string* get_Operation();
C++/CLI
public:
property String^ Operation {
   String^ get();
}

Property Value

A string containing the response action.

Remarks

This property returns the optional response action. For example, the value is "CAPABILITY" for the line below.

            * CAPABILITY IMAP4 IMAP4rev1 AUTH=CRAM-MD5 AUTH=PLAIN AUTH=LOGIN
>

See Also

Reference

ImapResponse Class
ImapResponse Members


Status Property

[image]
PowerTCP Mail for .NET
Status Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapResponse Class : Status Property

Glossary Item Box

Gets the status of the response.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Status As ImapStatus
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
Dim value As ImapStatus

value = instance.Status
C#
public ImapStatus Status {get;}
Managed Extensions for C++
public: __property ImapStatus get_Status();
C++/CLI
public:
property ImapStatus Status {
   ImapStatus get();
}

Property Value

An ImapStatus value.

Remarks

This property contains an ImapStatus value that represents the status of a server response. Typically, status responses come after commands are executed, but not all responses provide status. ResponseType is ImapResponseType.Status when the response provides status.

For example, the value is ImapStatus.Ok for the line below.

            A2 OK CAPABILITY completed

See Also

Reference

ImapResponse Class
ImapResponse Members


Tag Property

[image]
PowerTCP Mail for .NET
Tag Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapResponse Class : Tag Property

Glossary Item Box

Gets the unique identifier for the command.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Tag As String
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
Dim value As String

value = instance.Tag
C#
public string Tag {get;}
Managed Extensions for C++
public: __property string* get_Tag();
C++/CLI
public:
property String^ Tag {
   String^ get();
}

Property Value

A string representation of the response tag.

Remarks

This property returns the unique identifier found on tagged responses. This unique identifier corresponds to the id included with the corresponding command sent by the Imap component. For example, the value is "A2" for the line below.

            A2 OK CAPABILITY completed

See Also

Reference

ImapResponse Class
ImapResponse Members


Value Property

[image]
PowerTCP Mail for .NET
Value Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapResponse Class : Value Property

Glossary Item Box

Gets the first value/token of the response.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Value As String
Visual Basic (Usage) Copy Code
Dim instance As ImapResponse
Dim value As String

value = instance.Value
C#
public string Value {get;}
Managed Extensions for C++
public: __property string* get_Value();
C++/CLI
public:
property String^ Value {
   String^ get();
}

Property Value

The text indicating the value; otherwise an empty string.

Remarks

This property returns the first value/token in the response. For example, the value is "99" for the line below.

            * 99 EXISTS

This information is not included with all responses from the server.

See Also

Reference

ImapResponse Class
ImapResponse Members


ImapSearchParameter Class

[image]
PowerTCP Mail for .NET
ImapSearchParameter Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ImapSearchParameter Class

Glossary Item Box

Represents a search criteria for Mailbox.Search.

Object Model

ImapSearchParameter Class

Syntax

Visual Basic (Declaration)
Public Class ImapSearchParameter
Visual Basic (Usage) Copy Code
Dim instance As ImapSearchParameter
C#
public class ImapSearchParameter
Managed Extensions for C++
public __gc class ImapSearchParameter
C++/CLI
public ref class ImapSearchParameter

Remarks

Mailbox.Search sends the "SEARCH" command to the server with search criteria specified by an ImapSearchParameter array. ImapSearchParameters are combined with a logical AND. Other logical combinations can be represented using the ImapCriterion values ImapCriterion.Not and ImapCriterion.Or.

Inheritance Hierarchy

System.Object
Dart.Mail.ImapSearchParameter

See Also

Reference

ImapSearchParameter Members
Dart.Mail Namespace


ImapSearchParameter Class Members

[image]
PowerTCP Mail for .NET
ImapSearchParameter Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : ImapSearchParameter Class

Glossary Item Box

The following tables list the members exposed by ImapSearchParameter.

Public Constructors

 | Name | Description
Public Constructor | ImapSearchParameter Constructor | Overloaded.
Top

Public Properties

 | Name | Description
Public Property | Criterion | Gets or sets the search criterion.
Public Property | Parameter | Gets or sets the Criterion modifier.
Top

Public Methods

 | Name | Description
Public Method | ToString | Overloaded. Returns the string representation of this search parameter.
Top

See Also

Reference

ImapSearchParameter Class
Dart.Mail Namespace


ImapSearchParameter Constructor

[image]
PowerTCP Mail for .NET
ImapSearchParameter Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ImapSearchParameter Class : ImapSearchParameter Constructor

Glossary Item Box

Overload List

Overload | Description
ImapSearchParameter Constructor() | Creates a new instance of ImapSearchParameter.
ImapSearchParameter Constructor(ImapCriterion,String) | Creates a new instance of ImapSearchParameter.

See Also

Reference

ImapSearchParameter Class
ImapSearchParameter Members


ImapSearchParameter Constructor()

[image]
PowerTCP Mail for .NET
ImapSearchParameter Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > ImapSearchParameter Class > ImapSearchParameter Constructor : ImapSearchParameter Constructor()

Glossary Item Box

Creates a new instance of ImapSearchParameter.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New ImapSearchParameter()
C#
public ImapSearchParameter()
Managed Extensions for C++
public: ImapSearchParameter();
C++/CLI
public:
ImapSearchParameter();

Remarks

The default constructor creates an instance of ImapSearchParameter.

See Also

Reference

ImapSearchParameter Class
ImapSearchParameter Members
Overload List


ImapSearchParameter Constructor(ImapCriterion,String)

[image]
PowerTCP Mail for .NET
ImapSearchParameter Constructor(ImapCriterion,String)
See Also Example Send comments on this topic
Dart.Mail Namespace > ImapSearchParameter Class > ImapSearchParameter Constructor : ImapSearchParameter Constructor(ImapCriterion,String)

criterion
An ImapCriterion value representing the search criterion.
parameter
A string value which modifies criterion.

Glossary Item Box

Creates a new instance of ImapSearchParameter.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal criterion As ImapCriterion, _
   ByVal parameter As String _
)
Visual Basic (Usage) Copy Code
Dim criterion As ImapCriterion
Dim parameter As String

Dim instance As New ImapSearchParameter(criterion, parameter)
C#
public ImapSearchParameter(
   ImapCriterion criterion,
   string parameter
)
Managed Extensions for C++
public: ImapSearchParameter(
   ImapCriterion criterion,
   string* parameter
)
C++/CLI
public:
ImapSearchParameter(
   ImapCriterion criterion,
   String^ parameter
)

Parameters

criterion
An ImapCriterion value representing the search criterion.
parameter
A string value which modifies criterion.

Remarks

Creates a new instance of ImapSearchParameter, setting ImapSearchParameter.Criterion to criterion and ImapSearchParameter.Parameter to parameter.

Example

In this example, the Imap component copies messages that match a specified criteria to another mailbox.
C# Copy Code
private void getMessages(object state)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Set the selected mailbox to the Inbox
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    // Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON"
    ImapSearchParameter[] criteria = new ImapSearchParameter[]
    {
        new ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"),
        new ImapSearchParameter(ImapCriterion.Not, ""),
        new ImapSearchParameter(ImapCriterion.From, "JACKSON")
    };

    // Perform the search
    ImapMessage[] messages = imap1.SelectedMailbox.Search(criteria);

    //Copy all messages that meet the criteria to the 'Save' mailbox
    foreach (ImapMessage imapMessage in messages)
        imapMessage.CopyTo(imap1.Mailboxes["Save"]);

    //Gracefully logout
    imap1.Close();
}
Visual Basic Copy Code
Private Sub getMessages(ByVal state As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Set the selected mailbox to the Inbox
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    ' Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON"
    Dim criteria() As ImapSearchParameter = { New ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"), New ImapSearchParameter(ImapCriterion.Not, ""), New ImapSearchParameter(ImapCriterion.From, "JACKSON") }

    ' Perform the search
    Dim messages() As ImapMessage = imap1.SelectedMailbox.Search(criteria)

    'Copy all messages that meet the criteria to the 'Save' mailbox
    For Each imapMessage As ImapMessage In messages
        imapMessage.CopyTo(imap1.Mailboxes("Save"))
    Next imapMessage

    'Gracefully logout
    imap1.Close()
End Sub

See Also

Reference

ImapSearchParameter Class
ImapSearchParameter Members
Overload List


ImapSearchParameter Class Methods

[image]
PowerTCP Mail for .NET
ImapSearchParameter Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ImapSearchParameter Class

Glossary Item Box

For a list of all members of this type, see ImapSearchParameter members.

Public Methods

 | Name | Description
Public Method | ToString | Overloaded. Returns the string representation of this search parameter.
Top

See Also

Reference

ImapSearchParameter Class
Dart.Mail Namespace


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapSearchParameter Class : ToString Method

Glossary Item Box

Returns the string representation of this search parameter.

Overload List

Overload | Description
ToString() | Returns the string representation of this search parameter.
ToString(IFormatProvider) | Returns the string representation of this search parameter.

See Also

Reference

ImapSearchParameter Class
ImapSearchParameter Members


ToString() Method

[image]
PowerTCP Mail for .NET
ToString() Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapSearchParameter Class > ToString Method : ToString() Method

Glossary Item Box

Returns the string representation of this search parameter.

Syntax

Visual Basic (Declaration)
Public Overloads Overrides Function ToString() As String
Visual Basic (Usage) Copy Code
Dim instance As ImapSearchParameter
Dim value As String

value = instance.ToString()
C#
public override string ToString()
Managed Extensions for C++
public: string* ToString(); override
C++/CLI
public:
String^ ToString(); override

Return Value

A string representation of the parameter.

See Also

Reference

ImapSearchParameter Class
ImapSearchParameter Members
Overload List


ToString(IFormatProvider) Method

[image]
PowerTCP Mail for .NET
ToString(IFormatProvider) Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapSearchParameter Class > ToString Method : ToString(IFormatProvider) Method

provider

Glossary Item Box

Returns the string representation of this search parameter.

Syntax

Visual Basic (Declaration)
Public Overloads Overridable Function ToString( _
   ByVal provider As IFormatProvider _
) As String
Visual Basic (Usage) Copy Code
Dim instance As ImapSearchParameter
Dim provider As IFormatProvider
Dim value As String

value = instance.ToString(provider)
C#
public virtual string ToString(
   IFormatProvider provider
)
Managed Extensions for C++
public: virtual string* ToString(
   IFormatProvider* provider
)
C++/CLI
public:
virtual String^ ToString(
   IFormatProvider^ provider
)

Parameters

provider

Return Value

A string representation of the parameter.

See Also

Reference

ImapSearchParameter Class
ImapSearchParameter Members
Overload List


ImapSearchParameter Class Properties

[image]
PowerTCP Mail for .NET
ImapSearchParameter Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ImapSearchParameter Class

Glossary Item Box

For a list of all members of this type, see ImapSearchParameter members.

Public Properties

 | Name | Description
Public Property | Criterion | Gets or sets the search criterion.
Public Property | Parameter | Gets or sets the Criterion modifier.
Top

See Also

Reference

ImapSearchParameter Class
Dart.Mail Namespace


Criterion Property

[image]
PowerTCP Mail for .NET
Criterion Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapSearchParameter Class : Criterion Property

Glossary Item Box

Gets or sets the search criterion.

Syntax

Visual Basic (Declaration)
Public Property Criterion As ImapCriterion
Visual Basic (Usage) Copy Code
Dim instance As ImapSearchParameter
Dim value As ImapCriterion

instance.Criterion = value

value = instance.Criterion
C#
public ImapCriterion Criterion {get; set;}
Managed Extensions for C++
public: __property ImapCriterion get_Criterion();
public: __property void set_Criterion(
   ImapCriterion value
);
C++/CLI
public:
property ImapCriterion Criterion {
   ImapCriterion get();
   void set (    ImapCriterion value);
}

Property Value

An ImapCriterion value representing the search criterion.

Remarks

Use this property to restrict searches. For example, set this property to ImapCriterion.Flagged, add the ImapSearchParameter to an array and pass it to the Mailbox.Search method to get all messages with the Flagged flag set.

See Also

Reference

ImapSearchParameter Class
ImapSearchParameter Members


Parameter Property

[image]
PowerTCP Mail for .NET
Parameter Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapSearchParameter Class : Parameter Property

Glossary Item Box

Gets or sets the Criterion modifier.

Syntax

Visual Basic (Declaration)
Public Property Parameter As String
Visual Basic (Usage) Copy Code
Dim instance As ImapSearchParameter
Dim value As String

instance.Parameter = value

value = instance.Parameter
C#
public string Parameter {get; set;}
Managed Extensions for C++
public: __property string* get_Parameter();
public: __property void set_Parameter(
   string* value
);
C++/CLI
public:
property String^ Parameter {
   String^ get();
   void set (    String^ value);
}

Property Value

A string value which modifies the ImapSearchParameter.Criterion.

Remarks

For some criteria, a search parameter must be set (ImapCriteria.Before, ImapCriteria.To). For others, ImapSearchParameter.Criterion does not require a modifier (ImapCriterion.Answered). See ImapCriterion value descriptions to determine which criteria require a parameter.

See Also

Reference

ImapSearchParameter Class
ImapSearchParameter Members


ImapSession Class

[image]
PowerTCP Mail for .NET
ImapSession Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ImapSession Class

Glossary Item Box

Holds configuration specialized for Imap.

Object Model

ImapSession ClassIPEndPoint ClassProxy ClassIPEndPoint ClassMailSecurity Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class ImapSession
   Inherits MailSession
Visual Basic (Usage) Copy Code
Dim instance As ImapSession
C#
[Serializable()]
public class ImapSession : MailSession
Managed Extensions for C++
[Serializable()]
public __gc class ImapSession : public MailSession
C++/CLI
[Serializable()]
public ref class ImapSession : public MailSession

Inheritance Hierarchy

System.Object
Dart.Mail.Session
Dart.Mail.TcpSession
Dart.Mail.AuthenticatedSession
Dart.Mail.MailSession
Dart.Mail.ImapSession

See Also

Reference

ImapSession Members
Dart.Mail Namespace


ImapSession Class Members

[image]
PowerTCP Mail for .NET
ImapSession Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : ImapSession Class

Glossary Item Box

The following tables list the members exposed by ImapSession.

Public Constructors

 | Name | Description
Public Constructor | ImapSession Constructor | Default constructor.
Top

Public Properties

 | Name | Description
Public Property | Authentication | Authentication technique to use. Defaults to Authentication.Auto. (Inherited from Dart.Mail.MailSession)
Public Property | AutoUtf8 | If the server supports the "UTF8=ACCEPT" capability, a true value will enable the use of UTF8 encoding in quoted strings.
Public Property | BlockSize | Gets or sets the buffer size used during file and socket I/O. (Inherited from Dart.Mail.MailSession)
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out. (Inherited from Dart.Mail.TcpSession)
Public Property | Domain | Gets or sets the domain (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Password | Gets or sets the password or OAuth access token used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | PopulateMailboxTree | When true, the Mailbox.Mailboxes hierarchy is fully populated when Imap.Authenticate is used.
Public Property | Proxy | Defines the optional server proxy configuration. (Inherited from Dart.Mail.TcpSession)
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the privacy parameters to use with the mail server. See the MailSecurity class for more information. (Inherited from Dart.Mail.MailSession)
Public Property | ServicePrincipleName | Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Username | Gets or sets the username used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Top

Public Methods

 | Name | Description
Public Method | Clone | Creates a deep copy of the Session. (Inherited from Dart.Mail.MailSession)
Top

See Also

Reference

ImapSession Class
Dart.Mail Namespace


ImapSession Constructor

[image]
PowerTCP Mail for .NET
ImapSession Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ImapSession Class : ImapSession Constructor

Glossary Item Box

Default constructor.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New ImapSession()
C#
public ImapSession()
Managed Extensions for C++
public: ImapSession();
C++/CLI
public:
ImapSession();

See Also

Reference

ImapSession Class
ImapSession Members


ImapSession Class Properties

[image]
PowerTCP Mail for .NET
ImapSession Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ImapSession Class

Glossary Item Box

For a list of all members of this type, see ImapSession members.

Public Properties

 | Name | Description
Public Property | Authentication | Authentication technique to use. Defaults to Authentication.Auto. (Inherited from Dart.Mail.MailSession)
Public Property | AutoUtf8 | If the server supports the "UTF8=ACCEPT" capability, a true value will enable the use of UTF8 encoding in quoted strings.
Public Property | BlockSize | Gets or sets the buffer size used during file and socket I/O. (Inherited from Dart.Mail.MailSession)
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out. (Inherited from Dart.Mail.TcpSession)
Public Property | Domain | Gets or sets the domain (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Password | Gets or sets the password or OAuth access token used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | PopulateMailboxTree | When true, the Mailbox.Mailboxes hierarchy is fully populated when Imap.Authenticate is used.
Public Property | Proxy | Defines the optional server proxy configuration. (Inherited from Dart.Mail.TcpSession)
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the privacy parameters to use with the mail server. See the MailSecurity class for more information. (Inherited from Dart.Mail.MailSession)
Public Property | ServicePrincipleName | Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Username | Gets or sets the username used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Top

See Also

Reference

ImapSession Class
Dart.Mail Namespace


AutoUtf8 Property

[image]
PowerTCP Mail for .NET
AutoUtf8 Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapSession Class : AutoUtf8 Property

Glossary Item Box

If the server supports the "UTF8=ACCEPT" capability, a true value will enable the use of UTF8 encoding in quoted strings.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property AutoUtf8 As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ImapSession
Dim value As Boolean

instance.AutoUtf8 = value

value = instance.AutoUtf8
C#
[DefaultValue()]
public bool AutoUtf8 {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_AutoUtf8();
public: __property void set_AutoUtf8(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool AutoUtf8 {
   bool get();
   void set (    bool value);
}

Remarks

RFC 6855 specifies that UTF8 encoding can be used within quoted strings (breaking the IMAP 7-bit rule) if this option is enabled. Popular servers like Gmail support this capability, which is utilized for encoding and decoding UNICODE strings. This is useful for searching and listing mailboxes. When enabled, UTF8 encoding is used for mailbox names (instead of Imap.MailboxNameEncoding).

The user can determine what encoding if being used by checking the Imap.Connection.Encoding property. System.Text.Encoding.ASCII is used for normal 7-bit operation, and System.Text.Encoding.UTF8 is used when the "UTF8=ACCEPT" capability has been enabled and is in use.

See Also

Reference

ImapSession Class
ImapSession Members


PopulateMailboxTree Property

[image]
PowerTCP Mail for .NET
PopulateMailboxTree Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapSession Class : PopulateMailboxTree Property

Glossary Item Box

When true, the Mailbox.Mailboxes hierarchy is fully populated when Imap.Authenticate is used.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property PopulateMailboxTree As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ImapSession
Dim value As Boolean

instance.PopulateMailboxTree = value

value = instance.PopulateMailboxTree
C#
[DefaultValue()]
public bool PopulateMailboxTree {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_PopulateMailboxTree();
public: __property void set_PopulateMailboxTree(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool PopulateMailboxTree {
   bool get();
   void set (    bool value);
}

Remarks

The LIST and LSUB commands will be used at the end of the authentication process to build a local representation of the nested mailbox hierarchy. Set this property to false if nested mailbox information is not desired.

See Also

Reference

ImapSession Class
ImapSession Members


ImapUpdateEventArgs Class

[image]
PowerTCP Mail for .NET
ImapUpdateEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ImapUpdateEventArgs Class

Glossary Item Box

Provides data for Imap.Update.

Object Model

ImapUpdateEventArgs ClassImapMessage ClassImapResponse Class

Syntax

Visual Basic (Declaration)
Public Class ImapUpdateEventArgs
   Inherits System.EventArgs
Visual Basic (Usage) Copy Code
Dim instance As ImapUpdateEventArgs
C#
public class ImapUpdateEventArgs : System.EventArgs
Managed Extensions for C++
public __gc class ImapUpdateEventArgs : public System.EventArgs
C++/CLI
public ref class ImapUpdateEventArgs : public System.EventArgs

Remarks

Provides data for the Imap.Update event, which is raised when the server sends an unsolicited EXISTS or EXPUNGE, indicating that the selected mailbox has been updated. Messages represents the messages (if any) affected by the update as they appear in SelectedMailbox.

Response represents the server response.

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.ImapUpdateEventArgs

See Also

Reference

ImapUpdateEventArgs Members
Dart.Mail Namespace


ImapUpdateEventArgs Class Members

[image]
PowerTCP Mail for .NET
ImapUpdateEventArgs Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : ImapUpdateEventArgs Class

Glossary Item Box

The following tables list the members exposed by ImapUpdateEventArgs.

Public Properties

 | Name | Description
Public Property | Messages | Gets an ImapMessage array that represents the messages affected by the update.
Public Property | Response | Gets an ImapResponse encapsulating a response from the IMAP server.
Top

See Also

Reference

ImapUpdateEventArgs Class
Dart.Mail Namespace


ImapUpdateEventArgs Class Properties

[image]
PowerTCP Mail for .NET
ImapUpdateEventArgs Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ImapUpdateEventArgs Class

Glossary Item Box

For a list of all members of this type, see ImapUpdateEventArgs members.

Public Properties

 | Name | Description
Public Property | Messages | Gets an ImapMessage array that represents the messages affected by the update.
Public Property | Response | Gets an ImapResponse encapsulating a response from the IMAP server.
Top

See Also

Reference

ImapUpdateEventArgs Class
Dart.Mail Namespace


Messages Property

[image]
PowerTCP Mail for .NET
Messages Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapUpdateEventArgs Class : Messages Property

Glossary Item Box

Gets an ImapMessage array that represents the messages affected by the update.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Messages As ImapMessage()
Visual Basic (Usage) Copy Code
Dim instance As ImapUpdateEventArgs
Dim value() As ImapMessage

value = instance.Messages
C#
public ImapMessage[] Messages {get;}
Managed Extensions for C++
public: __property ImapMessage*[]* get_Messages();
C++/CLI
public:
property array<ImapMessage^>^ Messages {
   array<ImapMessage^>^ get();
}

Property Value

ImapMessage array that represents the messages affected by the update.

See Also

Reference

ImapUpdateEventArgs Class
ImapUpdateEventArgs Members


Response Property

[image]
PowerTCP Mail for .NET
Response Property
See Also Send comments on this topic
Dart.Mail Namespace > ImapUpdateEventArgs Class : Response Property

Glossary Item Box

Gets an ImapResponse encapsulating a response from the IMAP server.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Response As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As ImapUpdateEventArgs
Dim value As ImapResponse

value = instance.Response
C#
public ImapResponse Response {get;}
Managed Extensions for C++
public: __property ImapResponse* get_Response();
C++/CLI
public:
property ImapResponse^ Response {
   ImapResponse^ get();
}

Property Value

Returns an ImapResponse that represents the response from the server.

See Also

Reference

ImapUpdateEventArgs Class
ImapUpdateEventArgs Members


ImapUTF7 Class

[image]
PowerTCP Mail for .NET
ImapUTF7 Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ImapUTF7 Class

Glossary Item Box

Provides modified UTF-7 encoding for encoding/decoding Mailbox.Name.

Object Model

ImapUTF7 Class

Syntax

Visual Basic (Declaration)
Public Class ImapUTF7
   Inherits System.Text.Encoding
Visual Basic (Usage) Copy Code
Dim instance As ImapUTF7
C#
public class ImapUTF7 : System.Text.Encoding
Managed Extensions for C++
public __gc class ImapUTF7 : public System.Text.Encoding
C++/CLI
public ref class ImapUTF7 : public System.Text.Encoding

Inheritance Hierarchy

System.Object
System.Text.Encoding
Dart.Mail.ImapUTF7

See Also

Reference

ImapUTF7 Members
Dart.Mail Namespace


ImapUTF7 Class Members

[image]
PowerTCP Mail for .NET
ImapUTF7 Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : ImapUTF7 Class

Glossary Item Box

The following tables list the members exposed by ImapUTF7.

Public Constructors

 | Name | Description
Public Constructor | ImapUTF7 Constructor | Default constructor.
Top

Public Properties

 | Name | Description
Public Property | BodyName | (Inherited from System.Text.Encoding)
Public Property | CodePage | (Inherited from System.Text.Encoding)
Public Property | DecoderFallback | (Inherited from System.Text.Encoding)
Public Property | EncoderFallback | (Inherited from System.Text.Encoding)
Public Property | EncodingName | (Inherited from System.Text.Encoding)
Public Property | HeaderName | (Inherited from System.Text.Encoding)
Public Property | IsBrowserDisplay | (Inherited from System.Text.Encoding)
Public Property | IsBrowserSave | (Inherited from System.Text.Encoding)
Public Property | IsMailNewsDisplay | (Inherited from System.Text.Encoding)
Public Property | IsMailNewsSave | (Inherited from System.Text.Encoding)
Public Property | IsReadOnly | (Inherited from System.Text.Encoding)
Public Property | IsSingleByte | (Inherited from System.Text.Encoding)
Public Property | WebName | (Inherited from System.Text.Encoding)
Public Property | WindowsCodePage | (Inherited from System.Text.Encoding)
Top

Public Methods

 | Name | Description
Public Method | Clone | (Inherited from System.Text.Encoding)
Public Method | Equals | (Inherited from System.Text.Encoding)
Public Method | GetByteCount | Overloaded. Overridden. Computes the encoded byte count for the provided character array.
Public Method | GetBytes | Overloaded. Overridden. Encodes the provided characters into a byte array.
Public Method | GetCharCount | Overloaded. Overridden. Calculates the number of characters that would result from decoding a specified range of elements in a byte array.
Public Method | GetChars | Overloaded. Overridden. Decodes a range of elements from a specified byte array, and stores them in a specified range of elements in a Unicode character array.
Public Method | GetDecoder | (Inherited from System.Text.Encoding)
Public Method | GetEncoder | (Inherited from System.Text.Encoding)
Public Method | GetHashCode | (Inherited from System.Text.Encoding)
Public Method | GetMaxByteCount | Overridden. Calculates the maximum number of bytes required to encode a specified number of characters.
Public Method | GetMaxCharCount | Overridden. Calculates the maximum number of characters that can result from decoding a specified number of bytes.
Public Method | GetPreamble | (Inherited from System.Text.Encoding)
Public Method | GetString | Overloaded. (Inherited from System.Text.Encoding)
Public Method | IsAlwaysNormalized | Overloaded. (Inherited from System.Text.Encoding)
Top

See Also

Reference

ImapUTF7 Class
Dart.Mail Namespace


ImapUTF7 Constructor

[image]
PowerTCP Mail for .NET
ImapUTF7 Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class : ImapUTF7 Constructor

Glossary Item Box

Default constructor.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New ImapUTF7()
C#
public ImapUTF7()
Managed Extensions for C++
public: ImapUTF7();
C++/CLI
public:
ImapUTF7();

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members


ImapUTF7 Class Methods

[image]
PowerTCP Mail for .NET
ImapUTF7 Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ImapUTF7 Class

Glossary Item Box

For a list of all members of this type, see ImapUTF7 members.

Public Methods

 | Name | Description
Public Method | Clone | (Inherited from System.Text.Encoding)
Public Method | Equals | (Inherited from System.Text.Encoding)
Public Method | GetByteCount | Overloaded. Overridden. Computes the encoded byte count for the provided character array.
Public Method | GetBytes | Overloaded. Overridden. Encodes the provided characters into a byte array.
Public Method | GetCharCount | Overloaded. Overridden. Calculates the number of characters that would result from decoding a specified range of elements in a byte array.
Public Method | GetChars | Overloaded. Overridden. Decodes a range of elements from a specified byte array, and stores them in a specified range of elements in a Unicode character array.
Public Method | GetDecoder | (Inherited from System.Text.Encoding)
Public Method | GetEncoder | (Inherited from System.Text.Encoding)
Public Method | GetHashCode | (Inherited from System.Text.Encoding)
Public Method | GetMaxByteCount | Overridden. Calculates the maximum number of bytes required to encode a specified number of characters.
Public Method | GetMaxCharCount | Overridden. Calculates the maximum number of characters that can result from decoding a specified number of bytes.
Public Method | GetPreamble | (Inherited from System.Text.Encoding)
Public Method | GetString | Overloaded. (Inherited from System.Text.Encoding)
Public Method | IsAlwaysNormalized | Overloaded. (Inherited from System.Text.Encoding)
Top

See Also

Reference

ImapUTF7 Class
Dart.Mail Namespace


GetByteCount Method

[image]
PowerTCP Mail for .NET
GetByteCount Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class : GetByteCount Method

Glossary Item Box

Computes the encoded byte count for the provided character array.

Overload List

Overload | Description
GetByteCount(Char[],Int32,Int32) | Computes the encoded byte count for the provided character array.
GetByteCount(Char[]) | (Inherited from System.Text.Encoding)
GetByteCount(String) | (Inherited from System.Text.Encoding)
GetByteCount(Char,Int32) | (Inherited from System.Text.Encoding)

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members


GetByteCount(Char[],Int32,Int32) Method

[image]
PowerTCP Mail for .NET
GetByteCount(Char[],Int32,Int32) Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class > GetByteCount Method : GetByteCount(Char[],Int32,Int32) Method

chars
Characters to be encoded.
index
Indexer of first character.
count
Character count.

Glossary Item Box

Computes the encoded byte count for the provided character array.

Syntax

Visual Basic (Declaration)
Public Overloads Overrides Function GetByteCount( _
   ByVal chars() As Char, _
   ByVal index As Integer, _
   ByVal count As Integer _
) As Integer
Visual Basic (Usage) Copy Code
Dim instance As ImapUTF7
Dim chars() As Char
Dim index As Integer
Dim count As Integer
Dim value As Integer

value = instance.GetByteCount(chars, index, count)
C#
public override int GetByteCount(
   char[] chars,
   int index,
   int count
)
Managed Extensions for C++
public: int GetByteCount(
   char[]* chars,
   int index,
   int count
) override
C++/CLI
public:
int GetByteCount(
   array<char>^ chars,
   int index,
   int count
) override

Parameters

chars
Characters to be encoded.
index
Indexer of first character.
count
Character count.

Return Value

Number of bytes required by the encoding.

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members
Overload List


GetBytes Method

[image]
PowerTCP Mail for .NET
GetBytes Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class : GetBytes Method

Glossary Item Box

Encodes the provided characters into a byte array.

Overload List

Overload | Description
GetBytes(Char[],Int32,Int32,Byte[],Int32) | Encodes the provided characters into a byte array.
GetBytes(Char[]) | (Inherited from System.Text.Encoding)
GetBytes(Char[],Int32,Int32) | (Inherited from System.Text.Encoding)
GetBytes(String) | (Inherited from System.Text.Encoding)
GetBytes(String,Int32,Int32,Byte[],Int32) | (Inherited from System.Text.Encoding)
GetBytes(Char,Int32,Byte,Int32) | (Inherited from System.Text.Encoding)

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members


GetBytes(Char[],Int32,Int32,Byte[],Int32) Method

[image]
PowerTCP Mail for .NET
GetBytes(Char[],Int32,Int32,Byte[],Int32) Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class > GetBytes Method : GetBytes(Char[],Int32,Int32,Byte[],Int32) Method

chars
Characters to be encoded.
charIndex
Indexer of first character.
charCount
Character count.
bytes
Byte array destination.
byteIndex
Index for first output byte.

Glossary Item Box

Encodes the provided characters into a byte array.

Syntax

Visual Basic (Declaration)
Public Overloads Overrides Function GetBytes( _
   ByVal chars() As Char, _
   ByVal charIndex As Integer, _
   ByVal charCount As Integer, _
   ByVal bytes() As Byte, _
   ByVal byteIndex As Integer _
) As Integer
Visual Basic (Usage) Copy Code
Dim instance As ImapUTF7
Dim chars() As Char
Dim charIndex As Integer
Dim charCount As Integer
Dim bytes() As Byte
Dim byteIndex As Integer
Dim value As Integer

value = instance.GetBytes(chars, charIndex, charCount, bytes, byteIndex)
C#
public override int GetBytes(
   char[] chars,
   int charIndex,
   int charCount,
   byte[] bytes,
   int byteIndex
)
Managed Extensions for C++
public: int GetBytes(
   char[]* chars,
   int charIndex,
   int charCount,
   byte[]* bytes,
   int byteIndex
) override
C++/CLI
public:
int GetBytes(
   array<char>^ chars,
   int charIndex,
   int charCount,
   array<byte>^ bytes,
   int byteIndex
) override

Parameters

chars
Characters to be encoded.
charIndex
Indexer of first character.
charCount
Character count.
bytes
Byte array destination.
byteIndex
Index for first output byte.

Return Value

Number of bytes required by the encoding.

Remarks

Use GetByteCount(Char[],Int32,Int32) to calculate exactly, or GetMaxByteCount to calculate at most, the array size required by GetBytes(Char[],Int32,Int32,Byte[],Int32) to store encoded characters.

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members
Overload List


GetCharCount Method

[image]
PowerTCP Mail for .NET
GetCharCount Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class : GetCharCount Method

Glossary Item Box

Calculates the number of characters that would result from decoding a specified range of elements in a byte array.

Overload List

Overload | Description
GetCharCount(Byte[],Int32,Int32) | Calculates the number of characters that would result from decoding a specified range of elements in a byte array.
GetCharCount(Byte[]) | (Inherited from System.Text.Encoding)
GetCharCount(Byte,Int32) | (Inherited from System.Text.Encoding)

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members


GetCharCount(Byte[],Int32,Int32) Method

[image]
PowerTCP Mail for .NET
GetCharCount(Byte[],Int32,Int32) Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class > GetCharCount Method : GetCharCount(Byte[],Int32,Int32) Method

bytes
The byte array to decode.
index
The index of the first byte in bytes to decode.
count
The number of bytes to decode.

Glossary Item Box

Calculates the number of characters that would result from decoding a specified range of elements in a byte array.

Syntax

Visual Basic (Declaration)
Public Overloads Overrides Function GetCharCount( _
   ByVal bytes() As Byte, _
   ByVal index As Integer, _
   ByVal count As Integer _
) As Integer
Visual Basic (Usage) Copy Code
Dim instance As ImapUTF7
Dim bytes() As Byte
Dim index As Integer
Dim count As Integer
Dim value As Integer

value = instance.GetCharCount(bytes, index, count)
C#
public override int GetCharCount(
   byte[] bytes,
   int index,
   int count
)
Managed Extensions for C++
public: int GetCharCount(
   byte[]* bytes,
   int index,
   int count
) override
C++/CLI
public:
int GetCharCount(
   array<byte>^ bytes,
   int index,
   int count
) override

Parameters

bytes
The byte array to decode.
index
The index of the first byte in bytes to decode.
count
The number of bytes to decode.

Return Value

The number of characters that would result from decoding the specified range of elements in bytes.

Exceptions

Exception | Description
System.ArgumentNullException | bytes is a null reference.
System.ArgumentOutOfRangeException | index and count do not denote a valid range in bytes.

Remarks

Use GetCharCount(Byte[],Int32,Int32) to calculate exactly, or GetMaxCharCount to calculate at most, the array size required by GetChars(Byte[],Int32,Int32,Char[],Int32) to store decoded bytes.

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members
Overload List


GetChars Method

[image]
PowerTCP Mail for .NET
GetChars Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class : GetChars Method

Glossary Item Box

Decodes a range of elements from a specified byte array, and stores them in a specified range of elements in a Unicode character array.

Overload List

Overload | Description
GetChars(Byte[],Int32,Int32,Char[],Int32) | Decodes a range of elements from a specified byte array, and stores them in a specified range of elements in a Unicode character array.
GetChars(Byte[]) | (Inherited from System.Text.Encoding)
GetChars(Byte[],Int32,Int32) | (Inherited from System.Text.Encoding)
GetChars(Byte,Int32,Char,Int32) | (Inherited from System.Text.Encoding)

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members


GetChars(Byte[],Int32,Int32,Char[],Int32) Method

[image]
PowerTCP Mail for .NET
GetChars(Byte[],Int32,Int32,Char[],Int32) Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class > GetChars Method : GetChars(Byte[],Int32,Int32,Char[],Int32) Method

bytes
The byte array to decode.
byteIndex
The index of the first element in bytes to decode.
byteCount
The number of elements to decode.
chars
The character array where the decoded results are stored.
charIndex
The index of the first element in chars to store decoded results.

Glossary Item Box

Decodes a range of elements from a specified byte array, and stores them in a specified range of elements in a Unicode character array.

Syntax

Visual Basic (Declaration)
Public Overloads Overrides Function GetChars( _
   ByVal bytes() As Byte, _
   ByVal byteIndex As Integer, _
   ByVal byteCount As Integer, _
   ByVal chars() As Char, _
   ByVal charIndex As Integer _
) As Integer
Visual Basic (Usage) Copy Code
Dim instance As ImapUTF7
Dim bytes() As Byte
Dim byteIndex As Integer
Dim byteCount As Integer
Dim chars() As Char
Dim charIndex As Integer
Dim value As Integer

value = instance.GetChars(bytes, byteIndex, byteCount, chars, charIndex)
C#
public override int GetChars(
   byte[] bytes,
   int byteIndex,
   int byteCount,
   char[] chars,
   int charIndex
)
Managed Extensions for C++
public: int GetChars(
   byte[]* bytes,
   int byteIndex,
   int byteCount,
   char[]* chars,
   int charIndex
) override
C++/CLI
public:
int GetChars(
   array<byte>^ bytes,
   int byteIndex,
   int byteCount,
   array<char>^ chars,
   int charIndex
) override

Parameters

bytes
The byte array to decode.
byteIndex
The index of the first element in bytes to decode.
byteCount
The number of elements to decode.
chars
The character array where the decoded results are stored.
charIndex
The index of the first element in chars to store decoded results.

Return Value

The number of characters stored in chars.

Exceptions

Exception | Description
System.ArgumentNullException | bytes or chars is a null reference
System.ArgumentOutOfRangeException | byteIndex, byteCount, or charIndex is less than zero. -or- byteIndex plus byteCount is greater than the length of bytes. -or- charIndex is greater than the length of chars.
System.ArgumentException | bytes contains an invalid sequence of bytes

Remarks

Use GetCharCount(Byte[],Int32,Int32) to calculate exactly, or GetMaxCharCount to calculate at most, the array size required by GetChars(Byte[],Int32,Int32,Char[],Int32) to store decoded bytes.

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members
Overload List


GetMaxByteCount Method

[image]
PowerTCP Mail for .NET
GetMaxByteCount Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class : GetMaxByteCount Method

charCount
The number of characters to encode.

Glossary Item Box

Calculates the maximum number of bytes required to encode a specified number of characters.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetMaxByteCount( _
   ByVal charCount As Integer _
) As Integer
Visual Basic (Usage) Copy Code
Dim instance As ImapUTF7
Dim charCount As Integer
Dim value As Integer

value = instance.GetMaxByteCount(charCount)
C#
public override int GetMaxByteCount(
   int charCount
)
Managed Extensions for C++
public: int GetMaxByteCount(
   int charCount
) override
C++/CLI
public:
int GetMaxByteCount(
   int charCount
) override

Parameters

charCount
The number of characters to encode.

Return Value

The maximum number of bytes required to encode charCount number of characters.

Exceptions

Exception | Description
System.ArgumentOutOfRangeException | charCount is less than zero.

Remarks

Use GetByteCount(Char[],Int32,Int32) to calculate exactly, or GetMaxByteCount to calculate at most, the array size required by GetBytes(Char[],Int32,Int32,Byte[],Int32) to store encoded characters.

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members


GetMaxCharCount Method

[image]
PowerTCP Mail for .NET
GetMaxCharCount Method
See Also Send comments on this topic
Dart.Mail Namespace > ImapUTF7 Class : GetMaxCharCount Method

byteCount
The number of bytes to decode.

Glossary Item Box

Calculates the maximum number of characters that can result from decoding a specified number of bytes.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetMaxCharCount( _
   ByVal byteCount As Integer _
) As Integer
Visual Basic (Usage) Copy Code
Dim instance As ImapUTF7
Dim byteCount As Integer
Dim value As Integer

value = instance.GetMaxCharCount(byteCount)
C#
public override int GetMaxCharCount(
   int byteCount
)
Managed Extensions for C++
public: int GetMaxCharCount(
   int byteCount
) override
C++/CLI
public:
int GetMaxCharCount(
   int byteCount
) override

Parameters

byteCount
The number of bytes to decode.

Return Value

The maximum number of characters that can result from decoding byteCount number of bytes.

Remarks

Use GetCharCount(Byte[],Int32,Int32) to calculate exactly, or GetMaxCharCount to calculate at most, the array size required by GetChars(Byte[],Int32,Int32,Char[],Int32) to store decoded bytes.

See Also

Reference

ImapUTF7 Class
ImapUTF7 Members


IPEndPoint Class

[image]
PowerTCP Mail for .NET
IPEndPoint Class
Members See Also Send comments on this topic
Dart.Mail Namespace : IPEndPoint Class

Glossary Item Box

Allows user to specify a range of IPEndPoints for local binding. Also resolves hostnames and saves them for future use.

Object Model

IPEndPoint Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class IPEndPoint
   Inherits System.Net.IPEndPoint
Visual Basic (Usage) Copy Code
Dim instance As IPEndPoint
C#
[Serializable()]
public class IPEndPoint : System.Net.IPEndPoint
Managed Extensions for C++
[Serializable()]
public __gc class IPEndPoint : public System.Net.IPEndPoint
C++/CLI
[Serializable()]
public ref class IPEndPoint : public System.Net.IPEndPoint

Inheritance Hierarchy

System.Object
System.Net.EndPoint
System.Net.IPEndPoint
Dart.Mail.IPEndPoint

See Also

Reference

IPEndPoint Members
Dart.Mail Namespace


IPEndPoint Class Members

[image]
PowerTCP Mail for .NET
IPEndPoint Class Members
See Also Fields Properties Methods Send comments on this topic
Dart.Mail Namespace : IPEndPoint Class

Glossary Item Box

The following tables list the members exposed by IPEndPoint.

Public Constructors

 | Name | Description
Public Constructor | IPEndPoint Constructor | Overloaded.
Top

Public Fields

 | Name | Description
Public Field | Range | The socket will be bound to a port between IPEndPoint.Port and (IPEndPoint.Port + Range), inclusive.
Top

Public Properties

 | Name | Description
Public Property | Address | Gets or sets the address of the endpoint.
Public Property | AddressFamily | (Inherited from System.Net.IPEndPoint)
Public Property | HostNameOrAddress | Gets or sets the host name or address resolved to create this IPEndPoint. Also performs a DNS resolution.
Public Property | HostNameOrAddressColonPort | The host name or address used to create this IPEndPoint with ":port" appended.
Public Property | Port | Gets or sets the port number of the endpoint.
Top

Public Methods

 | Name | Description
Public Method | Create | (Inherited from System.Net.IPEndPoint)
Public Method | Equals | (Inherited from System.Net.IPEndPoint)
Public Method | GetHashCode | (Inherited from System.Net.IPEndPoint)
Public Method | Serialize | (Inherited from System.Net.IPEndPoint)
Public Method | ToString | (Inherited from System.Net.IPEndPoint)
Top

See Also

Reference

IPEndPoint Class
Dart.Mail Namespace


IPEndPoint Constructor

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class : IPEndPoint Constructor

Glossary Item Box

Overload List

Overload | Description
IPEndPoint Constructor() | Creates an IPEndPoint using IPAddress.Any and an ephemeral port (0).
IPEndPoint Constructor(AddressFamily) | Creates an IPEndPoint using IPAddress.Any or IPAddress.IPv6Any and an ephemeral port (0).
IPEndPoint Constructor(IPAddress,Int32) | Creates an IPEndPoint using a specified IPAddress and port.
IPEndPoint Constructor(IPAddress,Int32,Int32) | Creates an IPEndPoint using an IPAddress, port, and port range.
IPEndPoint Constructor(String) | Creates an IPEndPoint using a hostname or address, and port 0.
IPEndPoint Constructor(String,Int32) | Creates an IPEndPoint using a hostname or address, and port.
IPEndPoint Constructor(String,AddressFamily,Int32) | Creates an IPEndPoint using a hostname or address, port, and AddressFamily.
IPEndPoint Constructor(String,AddressFamily,Int32,Int32) | Creates an IPEndPoint using a hostname or address, address family, port and range.
IPEndPoint Constructor(String,String,Int32,Int32) | Creates an IPEndPoint using a hostname or address, address, port and range.

See Also

Reference

IPEndPoint Class
IPEndPoint Members


IPEndPoint Constructor()

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor()

Glossary Item Box

Creates an IPEndPoint using IPAddress.Any and an ephemeral port (0).

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New IPEndPoint()
C#
public IPEndPoint()
Managed Extensions for C++
public: IPEndPoint();
C++/CLI
public:
IPEndPoint();

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Constructor(AddressFamily)

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor(AddressFamily)
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor(AddressFamily)

addressFamily
AddressFamily to match.

Glossary Item Box

Creates an IPEndPoint using IPAddress.Any or IPAddress.IPv6Any and an ephemeral port (0).

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal addressFamily As AddressFamily _
)
Visual Basic (Usage) Copy Code
Dim addressFamily As AddressFamily

Dim instance As New IPEndPoint(addressFamily)
C#
public IPEndPoint(
   AddressFamily addressFamily
)
Managed Extensions for C++
public: IPEndPoint(
   AddressFamily addressFamily
)
C++/CLI
public:
IPEndPoint(
   AddressFamily addressFamily
)

Parameters

addressFamily
AddressFamily to match.

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Constructor(IPAddress,Int32)

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor(IPAddress,Int32)
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor(IPAddress,Int32)

address
An IPv4 or IPv6 address.
port
The port to bind to.

Glossary Item Box

Creates an IPEndPoint using a specified IPAddress and port.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal address As IPAddress, _
   ByVal port As Integer _
)
Visual Basic (Usage) Copy Code
Dim address As IPAddress
Dim port As Integer

Dim instance As New IPEndPoint(address, port)
C#
public IPEndPoint(
   IPAddress address,
   int port
)
Managed Extensions for C++
public: IPEndPoint(
   IPAddress* address,
   int port
)
C++/CLI
public:
IPEndPoint(
   IPAddress^ address,
   int port
)

Parameters

address
An IPv4 or IPv6 address.
port
The port to bind to.

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Constructor(IPAddress,Int32,Int32)

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor(IPAddress,Int32,Int32)
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor(IPAddress,Int32,Int32)

address
An IPv4 or IPv6 address.
port
The port to bind to.
range
The range of ports, starting at port, to attempt to bind to.

Glossary Item Box

Creates an IPEndPoint using an IPAddress, port, and port range.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal address As IPAddress, _
   ByVal port As Integer, _
   ByVal range As Integer _
)
Visual Basic (Usage) Copy Code
Dim address As IPAddress
Dim port As Integer
Dim range As Integer

Dim instance As New IPEndPoint(address, port, range)
C#
public IPEndPoint(
   IPAddress address,
   int port,
   int range
)
Managed Extensions for C++
public: IPEndPoint(
   IPAddress* address,
   int port,
   int range
)
C++/CLI
public:
IPEndPoint(
   IPAddress^ address,
   int port,
   int range
)

Parameters

address
An IPv4 or IPv6 address.
port
The port to bind to.
range
The range of ports, starting at port, to attempt to bind to.

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Constructor(String)

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor(String)
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor(String)

hostNameOrAddress
A hostname or an IPv4 or IPv6 address. Empty string resolves to the first local IPv4 network interface.

Glossary Item Box

Creates an IPEndPoint using a hostname or address, and port 0.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal hostNameOrAddress As String _
)
Visual Basic (Usage) Copy Code
Dim hostNameOrAddress As String

Dim instance As New IPEndPoint(hostNameOrAddress)
C#
public IPEndPoint(
   string hostNameOrAddress
)
Managed Extensions for C++
public: IPEndPoint(
   string* hostNameOrAddress
)
C++/CLI
public:
IPEndPoint(
   String^ hostNameOrAddress
)

Parameters

hostNameOrAddress
A hostname or an IPv4 or IPv6 address. Empty string resolves to the first local IPv4 network interface.

Remarks

The hostNameOrAddress parameter is limited to 126 characters in pre-4.0 versions of the .NET Framework, and 255 characters in versions 4.0 and higher.

If hostNameOrAddress is a hostname, resolves to the IPv4 address.

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Constructor(String,Int32)

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor(String,Int32)
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor(String,Int32)

hostNameOrAddress
A hostname or an IPv4 or IPv6 address. Empty string resolves to the first local IPv4 network interface.
port
The port to bind to.

Glossary Item Box

Creates an IPEndPoint using a hostname or address, and port.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal hostNameOrAddress As String, _
   ByVal port As Integer _
)
Visual Basic (Usage) Copy Code
Dim hostNameOrAddress As String
Dim port As Integer

Dim instance As New IPEndPoint(hostNameOrAddress, port)
C#
public IPEndPoint(
   string hostNameOrAddress,
   int port
)
Managed Extensions for C++
public: IPEndPoint(
   string* hostNameOrAddress,
   int port
)
C++/CLI
public:
IPEndPoint(
   String^ hostNameOrAddress,
   int port
)

Parameters

hostNameOrAddress
A hostname or an IPv4 or IPv6 address. Empty string resolves to the first local IPv4 network interface.
port
The port to bind to.

Remarks

The hostNameOrAddress parameter is limited to 126 characters in pre-4.0 versions of the .NET Framework, and 255 characters in versions 4.0 and higher.

If hostNameOrAddress is a hostname, resolves to the IPv4 address.

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Constructor(String,AddressFamily,Int32)

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor(String,AddressFamily,Int32)
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor(String,AddressFamily,Int32)

hostNameOrAddress
A hostname or string address. Empty string resolves to the first local network interface in the specified AddressFamily.
addressFamily
The System.Net.Sockets.AddressFamily to match if resolving a hostname.
port
The port to bind to.

Glossary Item Box

Creates an IPEndPoint using a hostname or address, port, and AddressFamily.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal hostNameOrAddress As String, _
   ByVal addressFamily As AddressFamily, _
   ByVal port As Integer _
)
Visual Basic (Usage) Copy Code
Dim hostNameOrAddress As String
Dim addressFamily As AddressFamily
Dim port As Integer

Dim instance As New IPEndPoint(hostNameOrAddress, addressFamily, port)
C#
public IPEndPoint(
   string hostNameOrAddress,
   AddressFamily addressFamily,
   int port
)
Managed Extensions for C++
public: IPEndPoint(
   string* hostNameOrAddress,
   AddressFamily addressFamily,
   int port
)
C++/CLI
public:
IPEndPoint(
   String^ hostNameOrAddress,
   AddressFamily addressFamily,
   int port
)

Parameters

hostNameOrAddress
A hostname or string address. Empty string resolves to the first local network interface in the specified AddressFamily.
addressFamily
The System.Net.Sockets.AddressFamily to match if resolving a hostname.
port
The port to bind to.

Remarks

The hostNameOrAddress parameter is limited to 126 characters in pre-4.0 versions of the .NET Framework, and 255 characters in versions 4.0 and higher.

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Constructor(String,AddressFamily,Int32,Int32)

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor(String,AddressFamily,Int32,Int32)
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor(String,AddressFamily,Int32,Int32)

hostNameOrAddress
A hostname or string address. Empty string resolves to the first local network interface in the specified AddressFamily.
addressFamily
The AddressFamily to match if resolving a hostname.
port
The port to bind to.
range
The range of ports, starting at port, to attempt to bind to.

Glossary Item Box

Creates an IPEndPoint using a hostname or address, address family, port and range.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal hostNameOrAddress As String, _
   ByVal addressFamily As AddressFamily, _
   ByVal port As Integer, _
   ByVal range As Integer _
)
Visual Basic (Usage) Copy Code
Dim hostNameOrAddress As String
Dim addressFamily As AddressFamily
Dim port As Integer
Dim range As Integer

Dim instance As New IPEndPoint(hostNameOrAddress, addressFamily, port, range)
C#
public IPEndPoint(
   string hostNameOrAddress,
   AddressFamily addressFamily,
   int port,
   int range
)
Managed Extensions for C++
public: IPEndPoint(
   string* hostNameOrAddress,
   AddressFamily addressFamily,
   int port,
   int range
)
C++/CLI
public:
IPEndPoint(
   String^ hostNameOrAddress,
   AddressFamily addressFamily,
   int port,
   int range
)

Parameters

hostNameOrAddress
A hostname or string address. Empty string resolves to the first local network interface in the specified AddressFamily.
addressFamily
The AddressFamily to match if resolving a hostname.
port
The port to bind to.
range
The range of ports, starting at port, to attempt to bind to.

Remarks

The socket will try to bind to the specified port. Upon failure, it will try with each successive port up to (port + range), until successful. An Exception is raised if all binding attempts fail.

The hostNameOrAddress parameter is limited to 126 characters in pre-4.0 versions of the .NET Framework, and 255 characters in versions 4.0 and higher.

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Constructor(String,String,Int32,Int32)

[image]
PowerTCP Mail for .NET
IPEndPoint Constructor(String,String,Int32,Int32)
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class > IPEndPoint Constructor : IPEndPoint Constructor(String,String,Int32,Int32)

hostNameOrAddress
A hostname or string address.
address
The IPAddress in string notation.
port
The port to bind to.
range
The range of ports, starting at port, to attempt to bind to.

Glossary Item Box

Creates an IPEndPoint using a hostname or address, address, port and range.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal hostNameOrAddress As String, _
   ByVal address As String, _
   ByVal port As Integer, _
   ByVal range As Integer _
)
Visual Basic (Usage) Copy Code
Dim hostNameOrAddress As String
Dim address As String
Dim port As Integer
Dim range As Integer

Dim instance As New IPEndPoint(hostNameOrAddress, address, port, range)
C#
public IPEndPoint(
   string hostNameOrAddress,
   string address,
   int port,
   int range
)
Managed Extensions for C++
public: IPEndPoint(
   string* hostNameOrAddress,
   string* address,
   int port,
   int range
)
C++/CLI
public:
IPEndPoint(
   String^ hostNameOrAddress,
   String^ address,
   int port,
   int range
)

Parameters

hostNameOrAddress
A hostname or string address.
address
The IPAddress in string notation.
port
The port to bind to.
range
The range of ports, starting at port, to attempt to bind to.

Remarks

This constructor is typically used to serialize the IPEndPoint and does not resolve hostNameOrAddress. The hostname can be needed for some proxies.

See Also

Reference

IPEndPoint Class
IPEndPoint Members
Overload List


IPEndPoint Class Properties

[image]
PowerTCP Mail for .NET
IPEndPoint Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : IPEndPoint Class

Glossary Item Box

For a list of all members of this type, see IPEndPoint members.

Public Properties

 | Name | Description
Public Property | Address | Gets or sets the address of the endpoint.
Public Property | AddressFamily | (Inherited from System.Net.IPEndPoint)
Public Property | HostNameOrAddress | Gets or sets the host name or address resolved to create this IPEndPoint. Also performs a DNS resolution.
Public Property | HostNameOrAddressColonPort | The host name or address used to create this IPEndPoint with ":port" appended.
Public Property | Port | Gets or sets the port number of the endpoint.
Top

See Also

Reference

IPEndPoint Class
Dart.Mail Namespace


Address Property

[image]
PowerTCP Mail for .NET
Address Property
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class : Address Property

Glossary Item Box

Gets or sets the address of the endpoint.

Syntax

Visual Basic (Declaration)
Public Shadows Property Address As IPAddress
Visual Basic (Usage) Copy Code
Dim instance As IPEndPoint
Dim value As IPAddress

instance.Address = value

value = instance.Address
C#
public new IPAddress Address {get; set;}
Managed Extensions for C++
public: __property new IPAddress* get_Address();
public: __property new void set_Address(
   IPAddress* value
);
C++/CLI
public:
new property IPAddress^ Address {
   IPAddress^ get();
   void set (    IPAddress^ value);
}

See Also

Reference

IPEndPoint Class
IPEndPoint Members


HostNameOrAddress Property

[image]
PowerTCP Mail for .NET
HostNameOrAddress Property
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class : HostNameOrAddress Property

Glossary Item Box

Gets or sets the host name or address resolved to create this IPEndPoint. Also performs a DNS resolution.

Syntax

Visual Basic (Declaration)
Public Property HostNameOrAddress As String
Visual Basic (Usage) Copy Code
Dim instance As IPEndPoint
Dim value As String

instance.HostNameOrAddress = value

value = instance.HostNameOrAddress
C#
public string HostNameOrAddress {get; set;}
Managed Extensions for C++
public: __property string* get_HostNameOrAddress();
public: __property void set_HostNameOrAddress(
   string* value
);
C++/CLI
public:
property String^ HostNameOrAddress {
   String^ get();
   void set (    String^ value);
}

Remarks

The value of this property is limited to 126 characters in pre-4.0 versions of the .NET Framework, and 255 characters in versions 4.0 and higher. IDN encoding is performed for DNS resolution if a non-ASCII hostname is provided.

See Also

Reference

IPEndPoint Class
IPEndPoint Members


HostNameOrAddressColonPort Property

[image]
PowerTCP Mail for .NET
HostNameOrAddressColonPort Property
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class : HostNameOrAddressColonPort Property

Glossary Item Box

The host name or address used to create this IPEndPoint with ":port" appended.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property HostNameOrAddressColonPort As String
Visual Basic (Usage) Copy Code
Dim instance As IPEndPoint
Dim value As String

value = instance.HostNameOrAddressColonPort
C#
public string HostNameOrAddressColonPort {get;}
Managed Extensions for C++
public: __property string* get_HostNameOrAddressColonPort();
C++/CLI
public:
property String^ HostNameOrAddressColonPort {
   String^ get();
}

Remarks

If HostNameOrAddress is an IPv6 address, the format includes square brackets as follows: [xx:yy...zz]:port.

See Also

Reference

IPEndPoint Class
IPEndPoint Members


Port Property

[image]
PowerTCP Mail for .NET
Port Property
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class : Port Property

Glossary Item Box

Gets or sets the port number of the endpoint.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Shadows Property Port As Integer
Visual Basic (Usage) Copy Code
Dim instance As IPEndPoint
Dim value As Integer

instance.Port = value

value = instance.Port
C#
[DefaultValue()]
public new int Port {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property new int get_Port();
public: __property new void set_Port(
   int value
);
C++/CLI
[DefaultValue()]
public:
new property int Port {
   int get();
   void set (    int value);
}

See Also

Reference

IPEndPoint Class
IPEndPoint Members


IPEndPoint Class Fields

[image]
PowerTCP Mail for .NET
IPEndPoint Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : IPEndPoint Class

Glossary Item Box

For a list of all members of this type, see IPEndPoint members.

Public Fields

 | Name | Description
Public Field | Range | The socket will be bound to a port between IPEndPoint.Port and (IPEndPoint.Port + Range), inclusive.
Top

See Also

Reference

IPEndPoint Class
Dart.Mail Namespace


Range Field

[image]
PowerTCP Mail for .NET
Range Field
See Also Send comments on this topic
Dart.Mail Namespace > IPEndPoint Class : Range Field

Glossary Item Box

The socket will be bound to a port between IPEndPoint.Port and (IPEndPoint.Port + Range), inclusive.

Syntax

Visual Basic (Declaration)
Public Range As Integer
Visual Basic (Usage) Copy Code
Dim instance As IPEndPoint
Dim value As Integer

value = instance.Range

instance.Range = value
C#
public int Range
Managed Extensions for C++
public: int Range
C++/CLI
public:
int Range

See Also

Reference

IPEndPoint Class
IPEndPoint Members


MailBase Class

[image]
PowerTCP Mail for .NET
MailBase Class
Members See Also Send comments on this topic
Dart.Mail Namespace : MailBase Class

Glossary Item Box

Base class used by Pop, Imap and Smtp.

Object Model

MailBase Class

Syntax

Visual Basic (Declaration)
Public Class MailBase
   Inherits ComponentBase
Visual Basic (Usage) Copy Code
Dim instance As MailBase
C#
public class MailBase : ComponentBase
Managed Extensions for C++
public __gc class MailBase : public ComponentBase
C++/CLI
public ref class MailBase : public ComponentBase

Inheritance Hierarchy

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.Mail.ComponentBase
Dart.Mail.MailBase
Dart.Mail.Imap
Dart.Mail.Pop
Dart.Mail.Smtp

See Also

Reference

MailBase Members
Dart.Mail Namespace


MailBase Class Members

[image]
PowerTCP Mail for .NET
MailBase Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : MailBase Class

Glossary Item Box

The following tables list the members exposed by MailBase.

Public Constructors

 | Name | Description
Public Constructor | MailBase Constructor | Default constructor. Sets SocketOption.ReceiveTimeout to 10000 (10 seconds).
Top

Public Properties

 | Name | Description
Public Property | Capabilities | Gets a List of strings representing the capabilities of the server.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Overridden. Specifies the character encoding to be used by the component.
Public Property | ServerGreeting | Gets the greeting received after connecting to the server.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

Public Methods

 | Name | Description
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | Start | Start a worker thread and execute the specified delegate.
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

MailBase Class
Dart.Mail Namespace


MailBase Constructor

[image]
PowerTCP Mail for .NET
MailBase Constructor
See Also Send comments on this topic
Dart.Mail Namespace > MailBase Class : MailBase Constructor

Glossary Item Box

Default constructor. Sets SocketOption.ReceiveTimeout to 10000 (10 seconds).

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New MailBase()
C#
public MailBase()
Managed Extensions for C++
public: MailBase();
C++/CLI
public:
MailBase();

See Also

Reference

MailBase Class
MailBase Members


MailBase Class Methods

[image]
PowerTCP Mail for .NET
MailBase Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : MailBase Class

Glossary Item Box

For a list of all members of this type, see MailBase members.

Public Methods

 | Name | Description
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | Start | Start a worker thread and execute the specified delegate.
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

MailBase Class
Dart.Mail Namespace


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > MailBase Class : Dispose Method

Glossary Item Box

Releases all resources associated with the object.

Overload List

Overload | Description
Dispose(Boolean) | Releases all resources associated with the object.
Dispose() | (Inherited from System.ComponentModel.Component)

See Also

Reference

MailBase Class
MailBase Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > MailBase Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As MailBase
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method abruptly aborts the connection and releases all resources.

Dispose should ONLY be used to release all resources used by the object, and the object should not be subsequently used. To gracefully disconnect from the server, use Close() before calling this method. The Object cannot be used once Dispose is called.

See Also

Reference

MailBase Class
MailBase Members
Overload List


Start Method

[image]
PowerTCP Mail for .NET
Start Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailBase Class : Start Method

worker
System.Threading.WaitCallback delegate for your function "void worker(object)".
state
Information to pass to the delegate method; can be null.

Glossary Item Box

Start a worker thread and execute the specified delegate.

Syntax

Visual Basic (Declaration)
Public Sub Start( _
   ByVal worker As WaitCallback, _
   ByVal state As Object _
)
Visual Basic (Usage) Copy Code
Dim instance As MailBase
Dim worker As WaitCallback
Dim state As Object

instance.Start(worker, state)
C#
public void Start(
   WaitCallback worker,
   object state
)
Managed Extensions for C++
public: void Start(
   WaitCallback* worker,
   Object* state
)
C++/CLI
public:
void Start(
   WaitCallback^ worker,
   Object^ state
)

Parameters

worker
System.Threading.WaitCallback delegate for your function "void worker(object)".
state
Information to pass to the delegate method; can be null.

Remarks

This method provides a convenient way to execute any method on a worker thread. Applications with a UI thread can use this technique to execute methods on a worker thread that would "freeze" the UI if executed on the UI thread.

Uncaught exceptions occurring on the worker thread will be automatically reported by raising the Error event.

Internally, this method uses ThreadPool.QueueUserWorkItem to start a worker thread. This method is provided for convenience; the developer may use alternative methods for starting worker threads if more specialized use is required.

Example

Demonstrates using Start(), Marshal() and the UserState event. Demonstrates sending a MailMessage on a worker thread.
C# Copy Code
private void button1_Click(object sender, EventArgs e)
{
    smtp1.Start(myBlockingFunction, myObject);
}

private void myBlockingFunction(object myObject)
{
    //This executes on a worker thread, so it could contain
    //any long-running code, and still not block the UI
    smtp1.Marshal("Message from the worker thread", null);
}

void smtp1_UserState(object sender, UserStateEventArgs e)
{
    MessageBox.Show(e.Message);
}
Visual Basic Copy Code
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    smtp1.Start(AddressOf myBlockingFunction, myObject)
End Sub

Private Sub myBlockingFunction(ByVal myObject As Object)
    'This executes on a worker thread, so it could contain
    'any long-running code, and still not block the UI
    smtp1.Marshal("Message from the worker thread", Nothing)
End Sub

Private Sub smtp1_UserState(ByVal sender As Object, ByVal e As UserStateEventArgs)
    MessageBox.Show(e.Message)
End Sub
C# Copy Code
private void button1_Click(object sender, EventArgs e)
{
    //Send a message to the specified recipient
    //The Start method is used to execute the operation on a worker thread
    //(Event handlers were added in the designer)
    smtp1.Start(sendMail, "myRecipient@dart.com");
}

private void sendMail(object state)
{
    //This function executes on a worker thread without blocking the UI
    //Create message to send
    MailMessage message = new MailMessage();
    message.To = state as string;
    message.From = "sender@dart.com";
    message.Subject = "Here is your file";
    message.Text = "Please see the attached file.";
    message.Attachments.Add(new Attachment("myAttachment.doc"));

    //Set session parameters
    smtp1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint("myMailServer", Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = "myUsername";
    smtp1.Session.Password = "myPassword";

    //Send message and logout
    smtp1.Send(message);
    smtp1.Close();
}

private void smtp1_Connection_Log(object sender, DataEventArgs e)
{
    //Log the communication to a textbox
    textBox1.AppendText(e.Data.ToString());
}

private void smtp1_Error(object sender, ErrorEventArgs e)
{
    //Any unhandled exception on the worker thread will be automatically marshaled here.
    MessageBox.Show(e.GetException().Message, "Error during send");
}
Visual Basic Copy Code
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    'Send a message to the specified recipient
    'The Start method is used to execute the operation on a worker thread
    '(Event handlers were added in the designer)
    smtp1.Start(AddressOf sendMail, "myRecipient@dart.com")
End Sub

Private Sub sendMail(ByVal state As Object)
    'This function executes on a worker thread without blocking the UI
    'Create message to send
    Dim message As New MailMessage()
    message.To = TryCast(state, String)
    message.From = "sender@dart.com"
    message.Subject = "Here is your file"
    message.Text = "Please see the attached file."
    message.Attachments.Add(New Attachment("myAttachment.doc"))

    'Set session parameters
    smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint("myMailServer", Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = "myUsername"
    smtp1.Session.Password = "myPassword"

    'Send message and logout
    smtp1.Send(message)
    smtp1.Close()
End Sub

Private Sub smtp1_Connection_Log(ByVal sender As Object, ByVal e As DataEventArgs)
    'Log the communication to a textbox
    textBox1.AppendText(e.Data.ToString())
End Sub

Private Sub smtp1_Error(ByVal sender As Object, ByVal e As ErrorEventArgs)
    'Any unhandled exception on the worker thread will be automatically marshaled here.
    MessageBox.Show(e.GetException().Message, "Error during send")
End Sub

See Also

Reference

MailBase Class
MailBase Members


MailBase Class Properties

[image]
PowerTCP Mail for .NET
MailBase Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : MailBase Class

Glossary Item Box

For a list of all members of this type, see MailBase members.

Public Properties

 | Name | Description
Public Property | Capabilities | Gets a List of strings representing the capabilities of the server.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Overridden. Specifies the character encoding to be used by the component.
Public Property | ServerGreeting | Gets the greeting received after connecting to the server.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

See Also

Reference

MailBase Class
Dart.Mail Namespace


Capabilities Property

[image]
PowerTCP Mail for .NET
Capabilities Property
See Also Send comments on this topic
Dart.Mail Namespace > MailBase Class : Capabilities Property

Glossary Item Box

Gets a List of strings representing the capabilities of the server.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Capabilities As List(Of String)
Visual Basic (Usage) Copy Code
Dim instance As MailBase
Dim value As List(Of String)

value = instance.Capabilities
C#
public List<string> Capabilities {get;}
Managed Extensions for C++
public: __property List<string*>* get_Capabilities();
C++/CLI
public:
property List<String^>^ Capabilities {
   List<String^>^ get();
}

Property Value

A System.Collections.Specialized.StringCollection.

Remarks

The component queries the server for a list of its capabilities, which is presented in this List. For example, if Imap.Capabilities contains "IDLE", then the server supports the IMAP IDLE command. If Pop.Capabilities contains "GSSAPI", the server supports GSSAPI authentication. If the server does not advertise its capabilities then this collection will be empty.

Pop capabilities are queried using the "CAPA" command. Imap capabilities are queried using the "CAPABILITY" command. Smtp capabilities are returned from the "EHLO" command, so are only available from ESMTP servers.

See Also

Reference

MailBase Class
MailBase Members


Encoding Property

[image]
PowerTCP Mail for .NET
Encoding Property
See Also Send comments on this topic
Dart.Mail Namespace > MailBase Class : Encoding Property

Glossary Item Box

Specifies the character encoding to be used by the component.

Syntax

Visual Basic (Declaration)
Public Overrides Property Encoding As Encoding
Visual Basic (Usage) Copy Code
Dim instance As MailBase
Dim value As Encoding

instance.Encoding = value

value = instance.Encoding
C#
public override Encoding Encoding {get; set;}
Managed Extensions for C++
public: __property Encoding* get_Encoding() override;
public: __property void set_Encoding(
   Encoding* value
) override;
C++/CLI
public:
property Encoding^ Encoding {
   Encoding^ get() override;
   void set (    Encoding^ value) override;
}

Remarks

When this property is set the component will use the specified encoding to encode and decode data on the underlying socket.

See Also

Reference

MailBase Class
MailBase Members


ServerGreeting Property

[image]
PowerTCP Mail for .NET
ServerGreeting Property
See Also Send comments on this topic
Dart.Mail Namespace > MailBase Class : ServerGreeting Property

Glossary Item Box

Gets the greeting received after connecting to the server.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property ServerGreeting As String
Visual Basic (Usage) Copy Code
Dim instance As MailBase
Dim value As String

value = instance.ServerGreeting
C#
public string ServerGreeting {get;}
Managed Extensions for C++
public: __property string* get_ServerGreeting();
C++/CLI
public:
property String^ ServerGreeting {
   String^ get();
}

Remarks

This String typically identifies the server.

See Also

Reference

MailBase Class
MailBase Members


Mailbox Class

[image]
PowerTCP Mail for .NET
Mailbox Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Mailbox Class

Glossary Item Box

Represents a mailbox on the IMAP server.

Object Model

Mailbox ClassImapMessage Class

Syntax

Visual Basic (Declaration)
Public Class Mailbox
   Inherits System.Collections.Generic.List(Of ImapMessage)
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
C#
public class Mailbox : System.Collections.Generic.List<ImapMessage>
Managed Extensions for C++
public __gc class Mailbox : public System.Collections.Generic.List<ImapMessage>
C++/CLI
public ref class Mailbox : public System.Collections.Generic.List<ImapMessage>

Remarks

Mailbox objects represent server mailboxes. Mailbox properties are updated when selected (see SelectedMailbox). While selected, server notifications (in response to commands or as unsolicited updates) may update properties of this class. For example, when the server sends EXPUNGE, the specified messages will be removed from this collection. When the server sends EXISTS, an ImapMessage is added.

Using properties or methods of this class may require communications with the server. For example, setting Name sends a RENAME command to the server.

Inheritance Hierarchy

System.Object
System.Collections.Generic.List<T>
Dart.Mail.Mailbox

See Also

Reference

Mailbox Members
Dart.Mail Namespace


Mailbox Class Members

[image]
PowerTCP Mail for .NET
Mailbox Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : Mailbox Class

Glossary Item Box

The following tables list the members exposed by Mailbox.

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Property | Count | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Property | FirstUnseen | Gets the first unseen message in the mailbox.
Public Property | FullName | Gets or sets the full path name of the mailbox.
Public Property | Imap | Returns the top-level Imap component the Mailbox belongs too.
Public Property | Item | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Property | Mailboxes | Gets a collection containing all sub-mailboxes in the mailbox.
Public Property | Marked | Gets a value indicating if the mailbox has been "marked."
Public Property | Name | Gets or sets the "short" name of the mailbox, excluding any parent mailbox.
Public Property | Parent | Returns the parent Mailbox in the hierarchy. This is null for root mailboxes.
Public Property | ReadOnly | Gets a value indicating if the mailbox is read-only.
Public Property | Recent | Gets the number of recent messages in the Mailbox.
Public Property | Selectable | Gets a value indicating if the mailbox can be selected.
Public Property | SublevelsAllowed | Gets a value indicating if mailboxes can be created below this mailbox.
Public Property | Tag | Gets or sets an object reference that can be used to associate this instance with any other object.
Top

Public Methods

 | Name | Description
Public Method | Add | Overloaded. Do not use. Use Add(MailMessage) instead.
Public Method | AddRange | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Clear | Clears all messages in the current mailbox.
Public Method | CompareTo | Compares the current instance with another object of the same type.
Public Method | Contains | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Copy | Overloaded. Copies an ImapMessageCollection of messages from this mailbox to the specified mailbox.
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Equals | Determines whether the specified object has the same name as this Mailbox.
Public Method | Exists | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Find | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Get | Overloaded. Retrieves all of the messages contained in the mailbox.
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | GetHashCode | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
Public Method | GetRange | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Insert | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Purge | Purge all messages marked for deletion.
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Search | Searches for messages within a mailbox matching the specified criteria.
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Subscribe | Subscribes the mailbox.
Public Method | ToArray | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Unsubscribe | Unsubscribes the mailbox.
Public Method | Update | Overloaded. Updates flag values on an array of messages from this Mailbox on the server.
Top

See Also

Reference

Mailbox Class
Dart.Mail Namespace


Mailbox Class Methods

[image]
PowerTCP Mail for .NET
Mailbox Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Mailbox Class

Glossary Item Box

For a list of all members of this type, see Mailbox members.

Public Methods

 | Name | Description
Public Method | Add | Overloaded. Do not use. Use Add(MailMessage) instead.
Public Method | AddRange | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Clear | Clears all messages in the current mailbox.
Public Method | CompareTo | Compares the current instance with another object of the same type.
Public Method | Contains | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Copy | Overloaded. Copies an ImapMessageCollection of messages from this mailbox to the specified mailbox.
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Equals | Determines whether the specified object has the same name as this Mailbox.
Public Method | Exists | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Find | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Get | Overloaded. Retrieves all of the messages contained in the mailbox.
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | GetHashCode | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
Public Method | GetRange | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Insert | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Purge | Purge all messages marked for deletion.
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Search | Searches for messages within a mailbox matching the specified criteria.
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Subscribe | Subscribes the mailbox.
Public Method | ToArray | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Method | Unsubscribe | Unsubscribes the mailbox.
Public Method | Update | Overloaded. Updates flag values on an array of messages from this Mailbox on the server.
Top

See Also

Reference

Mailbox Class
Dart.Mail Namespace


Add Method

[image]
PowerTCP Mail for .NET
Add Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Add Method

Glossary Item Box

Do not use. Use Add(MailMessage) instead.

Overload List

Overload | Description
Add(Stream,ImapFlags,DateTime) | Adds a new message with customized attributes to the mailbox using APPEND.
Add(MailMessage) | Adds a new message to the mailbox using APPEND.

See Also

Reference

Mailbox Class
Mailbox Members


Add(Stream,ImapFlags,DateTime) Method

[image]
PowerTCP Mail for .NET
Add(Stream,ImapFlags,DateTime) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Add Method : Add(Stream,ImapFlags,DateTime) Method

encodedMessage
Stream containing the encoded message.
flags
The ImapFlags to set on the message.
date
A System.DateTime representing the internal date to use for the message.

Glossary Item Box

Adds a new message with customized attributes to the mailbox using APPEND.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Add( _
   ByVal encodedMessage As Stream, _
   ByVal flags As ImapFlags, _
   ByVal date As Date _
)
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim encodedMessage As Stream
Dim flags As ImapFlags
Dim date As Date

instance.Add(encodedMessage, flags, date)
C#
public void Add(
   Stream encodedMessage,
   ImapFlags flags,
   DateTime date
)
Managed Extensions for C++
public: void Add(
   Stream* encodedMessage,
   ImapFlags flags,
   DateTime date
)
C++/CLI
public:
void Add(
   Stream^ encodedMessage,
   ImapFlags flags,
   DateTime date
)

Parameters

encodedMessage
Stream containing the encoded message.
flags
The ImapFlags to set on the message.
date
A System.DateTime representing the internal date to use for the message.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

Sends an APPEND command to the IMAP server, adding encodedMessage to this mailbox. flags determines which flags are set on the new message. date sets the internal date (the date the message arrived on the server). The newly added message will not be listed in the mailbox until the mailbox is updated by initiating another operation on the server. To manually update the mailbox, call Imap.Noop().

Example

This example demonstrates using the Imap component to upload a message to the mail server.
C# Copy Code
private void uploadMessage(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Create message to upload
    MailMessage message = new MailMessage();
    message.From = fromAddress;
    message.To = toAddress;
    message.Subject = "This is an uploaded message";
    message.Text = "This is an uploaded message.";

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Select mailbox to upload message to (assumes a 'Save' mailbox exists)
    imap1.SelectedMailbox = imap1.Mailboxes["Save"];

    //Upload the message
    imap1.SelectedMailbox.Add(message.GetEncodingStream(), ImapFlags.None, DateTime.Now);

    //Gracefully logout of the session
    imap1.Close();
}
Visual Basic Copy Code
Private Sub uploadMessage(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Create message to upload
    Dim message As New MailMessage()
    message.From = fromAddress
    message.To = toAddress
    message.Subject = "This is an uploaded message"
    message.Text = "This is an uploaded message."

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Select mailbox to upload message to (assumes a 'Save' mailbox exists)
    imap1.SelectedMailbox = imap1.Mailboxes("Save")

    'Upload the message
    imap1.SelectedMailbox.Add(message.GetEncodingStream(), ImapFlags.None, Date.Now)

    'Gracefully logout of the session
    imap1.Close()
End Sub

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


Add(MailMessage) Method

[image]
PowerTCP Mail for .NET
Add(MailMessage) Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Add Method : Add(MailMessage) Method

message
MailMessage to store on the server.

Glossary Item Box

Adds a new message to the mailbox using APPEND.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Add( _
   ByVal message As MailMessage _
)
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim message As MailMessage

instance.Add(message)
C#
public void Add(
   MailMessage message
)
Managed Extensions for C++
public: void Add(
   MailMessage* message
)
C++/CLI
public:
void Add(
   MailMessage^ message
)

Parameters

message
MailMessage to store on the server.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

Sends an APPEND command to the IMAP server, adding message to this mailbox. The newly added message will not be listed in the mailbox until the mailbox is updated by initiating another operation on the server. To manually update the mailbox, call Imap.Noop().

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


Clear Method

[image]
PowerTCP Mail for .NET
Clear Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Clear Method

Glossary Item Box

Clears all messages in the current mailbox.

Syntax

Visual Basic (Declaration)
Public Shadows Sub Clear()
Visual Basic (Usage) Copy Code
Dim instance As Mailbox

instance.Clear()
C#
public new void Clear()
Managed Extensions for C++
public: new void Clear();
C++/CLI
public:
new void Clear();

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

This method clears all messages in SelectedMailbox. This method sets all ImapMessage.Delete flags then sends an "EXPUNGE" command to the server.

See Also

Reference

Mailbox Class
Mailbox Members


CompareTo Method

[image]
PowerTCP Mail for .NET
CompareTo Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : CompareTo Method

obj
An object to compare with this instance.

Glossary Item Box

Compares the current instance with another object of the same type.

Syntax

Visual Basic (Declaration)
Public Function CompareTo( _
   ByVal obj As Object _
) As Integer
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim obj As Object
Dim value As Integer

value = instance.CompareTo(obj)
C#
public int CompareTo(
   object obj
)
Managed Extensions for C++
public: int CompareTo(
   Object* obj
)
C++/CLI
public:
int CompareTo(
   Object^ obj
)

Parameters

obj
An object to compare with this instance.

Return Value

A 32-bit signed integer that indicates the relative order of the comparands. The return value has these meanings:
Value | Meaning
Less than zero | This instance is less than obj.
Zero | This instance is equal to obj.
Greater than zero | This instance is greater than obj.

See Also

Reference

Mailbox Class
Mailbox Members


Copy Method

[image]
PowerTCP Mail for .NET
Copy Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Copy Method

Glossary Item Box

Copies an ImapMessageCollection of messages from this mailbox to the specified mailbox.

Overload List

Overload | Description
Copy(ImapMessage[],Mailbox) | Copies an ImapMessageCollection of messages from this mailbox to the specified mailbox.
Copy(ImapMessage,ImapMessage,Mailbox) | Copies a range of messages from this mailbox to the specified mailbox.

See Also

Reference

Mailbox Class
Mailbox Members


Copy(ImapMessage[],Mailbox) Method

[image]
PowerTCP Mail for .NET
Copy(ImapMessage[],Mailbox) Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Copy Method : Copy(ImapMessage[],Mailbox) Method

messages
Subset of messages found in this MailBox.
destination
Destination mailbox.

Glossary Item Box

Copies an ImapMessageCollection of messages from this mailbox to the specified mailbox.

Syntax

Visual Basic (Declaration)
Public Overloads Function Copy( _
   ByVal messages() As ImapMessage, _
   ByVal destination As Mailbox _
) As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim messages() As ImapMessage
Dim destination As Mailbox
Dim value As ImapResponse

value = instance.Copy(messages, destination)
C#
public ImapResponse Copy(
   ImapMessage[] messages,
   Mailbox destination
)
Managed Extensions for C++
public: ImapResponse* Copy(
   ImapMessage*[]* messages,
   Mailbox* destination
)
C++/CLI
public:
ImapResponse^ Copy(
   array<ImapMessage^>^ messages,
   Mailbox^ destination
)

Parameters

messages
Subset of messages found in this MailBox.
destination
Destination mailbox.

Remarks

Copies the messages specified to another mailbox. This method results in an IMAP COPY command being used. The command uses the UIDs of the messages to perform the copy operation. This method is useful for bulk operations. Use ImapMessage.CopyTo to copy a single message.

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


Copy(ImapMessage,ImapMessage,Mailbox) Method

[image]
PowerTCP Mail for .NET
Copy(ImapMessage,ImapMessage,Mailbox) Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Copy Method : Copy(ImapMessage,ImapMessage,Mailbox) Method

first
First message in the range to copy.
last
Last message in the range to copy.
destination
Destination mailbox.

Glossary Item Box

Copies a range of messages from this mailbox to the specified mailbox.

Syntax

Visual Basic (Declaration)
Public Overloads Function Copy( _
   ByVal first As ImapMessage, _
   ByVal last As ImapMessage, _
   ByVal destination As Mailbox _
) As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim first As ImapMessage
Dim last As ImapMessage
Dim destination As Mailbox
Dim value As ImapResponse

value = instance.Copy(first, last, destination)
C#
public ImapResponse Copy(
   ImapMessage first,
   ImapMessage last,
   Mailbox destination
)
Managed Extensions for C++
public: ImapResponse* Copy(
   ImapMessage* first,
   ImapMessage* last,
   Mailbox* destination
)
C++/CLI
public:
ImapResponse^ Copy(
   ImapMessage^ first,
   ImapMessage^ last,
   Mailbox^ destination
)

Parameters

first
First message in the range to copy.
last
Last message in the range to copy.
destination
Destination mailbox.

Remarks

Copies the messages contained within the range specified by first and last to another mailbox. This method results in an IMAP COPY command being used. The command uses the UIDs of the messages to perform the copy operation. This method is useful for bulk operations. Use ImapMessage.CopyTo to copy a single message.

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


Equals Method

[image]
PowerTCP Mail for .NET
Equals Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Equals Method

obj
The object to compare with the current object.

Glossary Item Box

Determines whether the specified object has the same name as this Mailbox.

Syntax

Visual Basic (Declaration)
Public Overrides Function Equals( _
   ByVal obj As Object _
) As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim obj As Object
Dim value As Boolean

value = instance.Equals(obj)
C#
public override bool Equals(
   object obj
)
Managed Extensions for C++
public: bool Equals(
   Object* obj
) override
C++/CLI
public:
bool Equals(
   Object^ obj
) override

Parameters

obj
The object to compare with the current object.

Return Value

true if the specified object has the same name as this object; otherwise, false.

See Also

Reference

Mailbox Class
Mailbox Members


Get Method

[image]
PowerTCP Mail for .NET
Get Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Get Method

Glossary Item Box

Retrieves all of the messages contained in the mailbox.

Overload List

Overload | Description
Get() | Retrieves all of the messages contained in the mailbox.
Get(ImapMessage[],ImapMessageInfo) | Retrieves and updates the specified mailbox messages.
Get(Int32,Int32,ImapMessageInfo) | Retrieves and updates the specified range of messages contained in the mailbox.

See Also

Reference

Mailbox Class
Mailbox Members


Get() Method

[image]
PowerTCP Mail for .NET
Get() Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Get Method : Get() Method

Glossary Item Box

Retrieves all of the messages contained in the mailbox.

Syntax

Visual Basic (Declaration)
Public Overloads Function Get() As ImapMessage()
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value() As ImapMessage

value = instance.Get()
C#
public ImapMessage[] Get()
Managed Extensions for C++
public: ImapMessage*[]* Get();
C++/CLI
public:
array<ImapMessage^>^ Get();

Return Value

Array of ImapMessage objects retrieved.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.

Remarks

Retrieves the messages contained in this mailbox and populates the collection. This method uses the IMAP FETCH command and UUIDs to retrieve message content. This method is useful for bulk operations. Use Get to retrieve a single message.

Example

This example demonstrates two methods of downloading all emails in the current mailbox, and saving them to disk.
C# Copy Code
/// <summary>
/// Downloads each message in the current mailbox and saves it to the specified directory.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
/// <param name="downloadFolder">The directory to save the emails in.</param>
public void GetMessagesInterleaved(Imap myImap, string downloadFolder)
{
    foreach (ImapMessage message in myImap.SelectedMailbox.ToArray())
    {
        //Confirm that the message in the copied array wasn't deleted by another client
        if (message.Id != 0)
        {
            message.Get();
            message.Message.Save(Path.Combine(downloadFolder, message.Uid + ".eml"));
        }
    }
}

/// <summary>
/// Downloads all messages in the current mailbox and then saves them to the specified directory.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
/// <param name="downloadFolder">The directory to save the emails in.</param>
public void GetMessages(Imap myImap, string downloadFolder)
{
    ImapMessage[] messages = myImap.SelectedMailbox.Get();
    foreach (ImapMessage message in messages)
        message.Message.Save(Path.Combine(downloadFolder, message.Uid + ".eml"));
}
Visual Basic Copy Code
''' <summary>
''' Downloads each message in the current mailbox and saves it to the specified directory.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
''' <param name="downloadFolder">The directory to save the emails in.</param>
Public Sub GetMessagesInterleaved(ByVal myImap As Imap, ByVal downloadFolder As String)
    For Each message As ImapMessage In myImap.SelectedMailbox.ToArray()
        'Confirm that the message in the copied array wasn't deleted by another client
        If message.Id <> 0 Then
            message.Get()
            message.Message.Save(Path.Combine(downloadFolder, message.Uid & ".eml"))
        End If
    Next message
End Sub

''' <summary>
''' Downloads all messages in the current mailbox and then saves them to the specified directory.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
''' <param name="downloadFolder">The directory to save the emails in.</param>
Public Sub GetMessages(ByVal myImap As Imap, ByVal downloadFolder As String)
    Dim messages() As ImapMessage = myImap.SelectedMailbox.Get()
    For Each message As ImapMessage In messages
        message.Message.Save(Path.Combine(downloadFolder, message.Uid & ".eml"))
    Next message
End Sub

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


Get(ImapMessage[],ImapMessageInfo) Method

[image]
PowerTCP Mail for .NET
Get(ImapMessage[],ImapMessageInfo) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Get Method : Get(ImapMessage[],ImapMessageInfo) Method

messages
Subset of messages found in this MailBox.
sections
Message sections to update.

Glossary Item Box

Retrieves and updates the specified mailbox messages.

Syntax

Visual Basic (Declaration)
Public Overloads Function Get( _
   ByVal messages() As ImapMessage, _
   ByVal sections As ImapMessageInfo _
) As ImapMessage()
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim messages() As ImapMessage
Dim sections As ImapMessageInfo
Dim value() As ImapMessage

value = instance.Get(messages, sections)
C#
public ImapMessage[] Get(
   ImapMessage[] messages,
   ImapMessageInfo sections
)
Managed Extensions for C++
public: ImapMessage*[]* Get(
   ImapMessage*[]* messages,
   ImapMessageInfo sections
)
C++/CLI
public:
array<ImapMessage^>^ Get(
   array<ImapMessage^>^ messages,
   ImapMessageInfo sections
)

Parameters

messages
Subset of messages found in this MailBox.
sections
Message sections to update.

Return Value

Array of ImapMessage objects retrieved.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.

Remarks

Retrieves a section of the specified messages. This method uses the IMAP FETCH command and UUIDs to retrieve message content. This method is useful for bulk operations. Use Get to retrieve a single message.

Example

This example demonstrates retrieving the headers for all messages in the current mailbox.
C# Copy Code
/// <summary>
/// Retrieves the headers for all messages in the current mailbox.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
public void GetMessageHeaders(Imap myImap)
{
    //Get headers for all messages in the box
    myImap.SelectedMailbox.Get(myImap.SelectedMailbox.ToArray(), ImapMessageInfo.Header);
}
Visual Basic Copy Code
''' <summary>
''' Retrieves the headers for all messages in the current mailbox.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param>
Public Sub GetMessageHeaders(ByVal myImap As Imap)
    'Get headers for all messages in the box
    myImap.SelectedMailbox.Get(myImap.SelectedMailbox.ToArray(), ImapMessageInfo.Header)
End Sub

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


Get(Int32,Int32,ImapMessageInfo) Method

[image]
PowerTCP Mail for .NET
Get(Int32,Int32,ImapMessageInfo) Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Get Method : Get(Int32,Int32,ImapMessageInfo) Method

startIndex
Index of first message to get.
length
Number of sequential messages to get.
sections
Message sections to update.

Glossary Item Box

Retrieves and updates the specified range of messages contained in the mailbox.

Syntax

Visual Basic (Declaration)
Public Overloads Function Get( _
   ByVal startIndex As Integer, _
   ByVal length As Integer, _
   ByVal sections As ImapMessageInfo _
) As ImapMessage()
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim startIndex As Integer
Dim length As Integer
Dim sections As ImapMessageInfo
Dim value() As ImapMessage

value = instance.Get(startIndex, length, sections)
C#
public ImapMessage[] Get(
   int startIndex,
   int length,
   ImapMessageInfo sections
)
Managed Extensions for C++
public: ImapMessage*[]* Get(
   int startIndex,
   int length,
   ImapMessageInfo sections
)
C++/CLI
public:
array<ImapMessage^>^ Get(
   int startIndex,
   int length,
   ImapMessageInfo sections
)

Parameters

startIndex
Index of first message to get.
length
Number of sequential messages to get.
sections
Message sections to update.

Return Value

Array of ImapMessage objects retrieved.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.

Remarks

Retrieves sections of a message range. This method uses the IMAP FETCH command and UUIDs to retrieve message content. This method is useful for bulk operations. Use Get to retrieve a single message.

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


GetHashCode Method

[image]
PowerTCP Mail for .NET
GetHashCode Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : GetHashCode Method

Glossary Item Box

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetHashCode() As Integer
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Integer

value = instance.GetHashCode()
C#
public override int GetHashCode()
Managed Extensions for C++
public: int GetHashCode(); override
C++/CLI
public:
int GetHashCode(); override

Return Value

A hash code for the current Object.

See Also

Reference

Mailbox Class
Mailbox Members


Purge Method

[image]
PowerTCP Mail for .NET
Purge Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Purge Method

Glossary Item Box

Purge all messages marked for deletion.

Syntax

Visual Basic (Declaration)
Public Function Purge() As ImapResponse()
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value() As ImapResponse

value = instance.Purge()
C#
public ImapResponse[] Purge()
Managed Extensions for C++
public: ImapResponse*[]* Purge();
C++/CLI
public:
array<ImapResponse^>^ Purge();

Return Value

An ImapResponse object encapsulating the response from the server.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException |

Remarks

Purges all messages marked for deletion (ImapMessage.Deleted == true). This method uses the IMAP EXPUNGE command to delete all marked messages. Not normally used because marked messages are automatically deleted when the mailbox is closed or another mailbox is selected.

See Also

Reference

Mailbox Class
Mailbox Members


Search Method

[image]
PowerTCP Mail for .NET
Search Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Search Method

criteria
An array of one or more ImapSearchParameter objects, defining the type of search to perform.

Glossary Item Box

Searches for messages within a mailbox matching the specified criteria.

Syntax

Visual Basic (Declaration)
Public Function Search( _
   ByVal criteria() As ImapSearchParameter _
) As ImapMessage()
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim criteria() As ImapSearchParameter
Dim value() As ImapMessage

value = instance.Search(criteria)
C#
public ImapMessage[] Search(
   ImapSearchParameter[] criteria
)
Managed Extensions for C++
public: ImapMessage*[]* Search(
   ImapSearchParameter*[]* criteria
)
C++/CLI
public:
array<ImapMessage^>^ Search(
   array<ImapSearchParameter^>^ criteria
)

Parameters

criteria
An array of one or more ImapSearchParameter objects, defining the type of search to perform.

Return Value

An array of ImapMessage objects which meet the criteria.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.
System.InvalidCastException | Specified cast is invalid.

Remarks

This method sends the "SEARCH" command to the server. Multiple ImapSearchParameters are combined with a logical AND. Other logical combinations can be represented using the ImapCriterion values ImapCriterion.Not and ImapCriterion.Or. See RFC 3501 or other on-line resources for guidance on how to use this powerful search tool.

If Imap.Session.AutoUtf8 is set to true, and the server advertises UTF8=ACCEPT, UTF8 will be used for encoding and decoding UNICODE strings.

Example

In this example, the Imap component copies messages that match a specified criteria to another mailbox.
C# Copy Code
private void getMessages(object state)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Set the selected mailbox to the Inbox
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    // Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON"
    ImapSearchParameter[] criteria = new ImapSearchParameter[]
    {
        new ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"),
        new ImapSearchParameter(ImapCriterion.Not, ""),
        new ImapSearchParameter(ImapCriterion.From, "JACKSON")
    };

    // Perform the search
    ImapMessage[] messages = imap1.SelectedMailbox.Search(criteria);

    //Copy all messages that meet the criteria to the 'Save' mailbox
    foreach (ImapMessage imapMessage in messages)
        imapMessage.CopyTo(imap1.Mailboxes["Save"]);

    //Gracefully logout
    imap1.Close();
}
Visual Basic Copy Code
Private Sub getMessages(ByVal state As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Set the selected mailbox to the Inbox
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    ' Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON"
    Dim criteria() As ImapSearchParameter = { New ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"), New ImapSearchParameter(ImapCriterion.Not, ""), New ImapSearchParameter(ImapCriterion.From, "JACKSON") }

    ' Perform the search
    Dim messages() As ImapMessage = imap1.SelectedMailbox.Search(criteria)

    'Copy all messages that meet the criteria to the 'Save' mailbox
    For Each imapMessage As ImapMessage In messages
        imapMessage.CopyTo(imap1.Mailboxes("Save"))
    Next imapMessage

    'Gracefully logout
    imap1.Close()
End Sub

See Also

Reference

Mailbox Class
Mailbox Members


Subscribe Method

[image]
PowerTCP Mail for .NET
Subscribe Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Subscribe Method

Glossary Item Box

Subscribes the mailbox.

Syntax

Visual Basic (Declaration)
Public Function Subscribe() As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As ImapResponse

value = instance.Subscribe()
C#
public ImapResponse Subscribe()
Managed Extensions for C++
public: ImapResponse* Subscribe();
C++/CLI
public:
ImapResponse^ Subscribe();

Return Value

An ImapResponse object encapsulating the response from the server.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

This method sends the SUBSCRIBE command to the server, which adds the mailbox to the server's set of the user's subscribed mailboxes.

To get a list of subscribed mailboxes use

Imap.List("", "%", true);

Example

This example demonstrates how to create, rename and delete a mailbox. It also shows how to subscribe and unsubscribe a mailbox.
C# Copy Code
private void doMailboxFunctions(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Create a mailbox
    Mailbox newBox = imap1.Mailboxes.Add("My_New_Box");

    //Subscribe the mailbox and check the subscribed list
    newBox.Subscribe();
    //Get all subscribed mailboxes
    List<Mailbox> list = imap1.List("", "%", true).ToList<Mailbox>();
    if (!list.Contains(newBox)) throw new Exception("Server did not subscribe the mailbox.");

    //Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe();
    list = imap1.List("", "%", true).ToList<Mailbox>();
    if (list.Contains(newBox)) throw new Exception("Server did not unsubscribe the mailbox.");

    //Rename the mailbox and then delete it
    newBox.Name = newBox.Name + "_Renamed";
    imap1.Mailboxes.Remove(newBox);

    //Gracefully logout of the session
    imap1.Close();
}
Visual Basic Copy Code
Private Sub doMailboxFunctions(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Create a mailbox
    Dim newBox As Mailbox = imap1.Mailboxes.Add("My_New_Box")

    'Subscribe the mailbox and check the subscribed list
    newBox.Subscribe()
    'Get all subscribed mailboxes
    Dim list As List(Of Mailbox) = imap1.List("", "%", True).ToList()
    If Not list.Contains(newBox) Then
        Throw New Exception("Server did not subscribe the mailbox.")
    End If

    'Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe()
    list = imap1.List("", "%", True).ToList()
    If list.Contains(newBox) Then
        Throw New Exception("Server did not unsubscribe the mailbox.")
    End If

    'Rename the mailbox and then delete it
    newBox.Name = newBox.Name & "_Renamed"
    imap1.Mailboxes.Remove(newBox)

    'Gracefully logout of the session
    imap1.Close()
End Sub

See Also

Reference

Mailbox Class
Mailbox Members


Unsubscribe Method

[image]
PowerTCP Mail for .NET
Unsubscribe Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Unsubscribe Method

Glossary Item Box

Unsubscribes the mailbox.

Syntax

Visual Basic (Declaration)
Public Function Unsubscribe() As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As ImapResponse

value = instance.Unsubscribe()
C#
public ImapResponse Unsubscribe()
Managed Extensions for C++
public: ImapResponse* Unsubscribe();
C++/CLI
public:
ImapResponse^ Unsubscribe();

Return Value

An ImapResponse object encapsulating the response from the server.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

This method sends the UNSUBSCRIBE command to the server, which removes the mailbox from the server's set of the user's subscribed mailboxes.

To get a list of subscribed mailboxes use

Imap.List("", "%", true);

Example

This example demonstrates how to create, rename and delete a mailbox. It also shows how to subscribe and unsubscribe a mailbox.
C# Copy Code
private void doMailboxFunctions(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Create a mailbox
    Mailbox newBox = imap1.Mailboxes.Add("My_New_Box");

    //Subscribe the mailbox and check the subscribed list
    newBox.Subscribe();
    //Get all subscribed mailboxes
    List<Mailbox> list = imap1.List("", "%", true).ToList<Mailbox>();
    if (!list.Contains(newBox)) throw new Exception("Server did not subscribe the mailbox.");

    //Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe();
    list = imap1.List("", "%", true).ToList<Mailbox>();
    if (list.Contains(newBox)) throw new Exception("Server did not unsubscribe the mailbox.");

    //Rename the mailbox and then delete it
    newBox.Name = newBox.Name + "_Renamed";
    imap1.Mailboxes.Remove(newBox);

    //Gracefully logout of the session
    imap1.Close();
}
Visual Basic Copy Code
Private Sub doMailboxFunctions(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Create a mailbox
    Dim newBox As Mailbox = imap1.Mailboxes.Add("My_New_Box")

    'Subscribe the mailbox and check the subscribed list
    newBox.Subscribe()
    'Get all subscribed mailboxes
    Dim list As List(Of Mailbox) = imap1.List("", "%", True).ToList()
    If Not list.Contains(newBox) Then
        Throw New Exception("Server did not subscribe the mailbox.")
    End If

    'Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe()
    list = imap1.List("", "%", True).ToList()
    If list.Contains(newBox) Then
        Throw New Exception("Server did not unsubscribe the mailbox.")
    End If

    'Rename the mailbox and then delete it
    newBox.Name = newBox.Name & "_Renamed"
    imap1.Mailboxes.Remove(newBox)

    'Gracefully logout of the session
    imap1.Close()
End Sub

See Also

Reference

Mailbox Class
Mailbox Members


Update Method

[image]
PowerTCP Mail for .NET
Update Method
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Update Method

Glossary Item Box

Updates flag values on an array of messages from this Mailbox on the server.

Overload List

Overload | Description
Update(ImapMessage[],Boolean,ImapFlags) | Updates flag values on an array of messages from this Mailbox on the server.
Update(Int32,Int32,Boolean,ImapFlags) | Updates flag values on a range of messages from this Mailbox on the server.

See Also

Reference

Mailbox Class
Mailbox Members


Update(ImapMessage[],Boolean,ImapFlags) Method

[image]
PowerTCP Mail for .NET
Update(ImapMessage[],Boolean,ImapFlags) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Update Method : Update(ImapMessage[],Boolean,ImapFlags) Method

messages
Subset of messages from this MailBox.
set
Use true to add the flags and false to remove them.
flags
ImapFlags value specifying the flag(s) to modify.

Glossary Item Box

Updates flag values on an array of messages from this Mailbox on the server.

Syntax

Visual Basic (Declaration)
Public Overloads Function Update( _
   ByVal messages() As ImapMessage, _
   ByVal set As Boolean, _
   ByVal flags As ImapFlags _
) As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim messages() As ImapMessage
Dim set As Boolean
Dim flags As ImapFlags
Dim value As ImapResponse

value = instance.Update(messages, set, flags)
C#
public ImapResponse Update(
   ImapMessage[] messages,
   bool set,
   ImapFlags flags
)
Managed Extensions for C++
public: ImapResponse* Update(
   ImapMessage*[]* messages,
   bool set,
   ImapFlags flags
)
C++/CLI
public:
ImapResponse^ Update(
   array<ImapMessage^>^ messages,
   bool set,
   ImapFlags flags
)

Parameters

messages
Subset of messages from this MailBox.
set
Use true to add the flags and false to remove them.
flags
ImapFlags value specifying the flag(s) to modify.

Return Value

ImapResponse encapsulating the response from the server.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

Sets or resets the values of one or more flags on the specified messages. Update can be used to update flags on a single message. Update(Int32,Int32,Boolean,ImapFlags) can be used to update a range of messages.

Example

The following example demonstrates setting the delete flag on a range or set of messages, and optionally deleting them immediately.
C# Copy Code
/// <summary>
/// Sets the delete flag on a range of messages, and optionally deletes them immediately.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance.</param>
/// <param name="startIndex">The index of the first message to delete. Corresponds to the index of the message in myImap.SelectedMailbox.</param>
/// <param name="length">The number of messages after startIndex to delete.</param>
/// <param name="purge">True to delete immediately. False to not delete immediately; wait until logout or a subsequent call to Purge().</param>
public void DeleteMessages(Imap myImap, int startIndex, int length, bool purge)
{
    myImap.SelectedMailbox.Update(startIndex, length, true, ImapFlags.Deleted);

    if (purge)
        myImap.SelectedMailbox.Purge();
}

/// <summary>
/// Sets the delete flag on the specified messages, and optionally deletes them immediately.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance.</param>
/// <param name="messages">An array of messages from myImap.SelectedMailbox to delete.</param>
/// <param name="purge">True to delete immediately. False to not delete immediately; wait until logout or a subsequent call to Purge().</param>
public void DeleteMessages(Imap myImap, ImapMessage[] messages, bool purge)
{
    myImap.SelectedMailbox.Update(messages, true, ImapFlags.Deleted);

    if (purge)
        myImap.SelectedMailbox.Purge();
}
Visual Basic Copy Code
''' <summary>
''' Sets the delete flag on a range of messages, and optionally deletes them immediately.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance.</param>
''' <param name="startIndex">The index of the first message to delete. Corresponds to the index of the message in myImap.SelectedMailbox.</param>
''' <param name="length">The number of messages after startIndex to delete.</param>
''' <param name="purge">True to delete immediately. False to not delete immediately; wait until logout or a subsequent call to Purge().</param>
Public Sub DeleteMessages(ByVal myImap As Imap, ByVal startIndex As Integer, ByVal length As Integer, ByVal purge As Boolean)
    myImap.SelectedMailbox.Update(startIndex, length, True, ImapFlags.Deleted)

    If purge Then
        myImap.SelectedMailbox.Purge()
    End If
End Sub

''' <summary>
''' Sets the delete flag on the specified messages, and optionally deletes them immediately.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance.</param>
''' <param name="messages">An array of messages from myImap.SelectedMailbox to delete.</param>
''' <param name="purge">True to delete immediately. False to not delete immediately; wait until logout or a subsequent call to Purge().</param>
Public Sub DeleteMessages(ByVal myImap As Imap, ByVal messages() As ImapMessage, ByVal purge As Boolean)
    myImap.SelectedMailbox.Update(messages, True, ImapFlags.Deleted)

    If purge Then
        myImap.SelectedMailbox.Purge()
    End If
End Sub

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


Update(Int32,Int32,Boolean,ImapFlags) Method

[image]
PowerTCP Mail for .NET
Update(Int32,Int32,Boolean,ImapFlags) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class > Update Method : Update(Int32,Int32,Boolean,ImapFlags) Method

startIndex
The first message in the range.
length
The number of messages to set.
set
Use true to add the flags and false to remove them.
flags
ImapFlags value specifying the flag(s) to modify.

Glossary Item Box

Updates flag values on a range of messages from this Mailbox on the server.

Syntax

Visual Basic (Declaration)
Public Overloads Function Update( _
   ByVal startIndex As Integer, _
   ByVal length As Integer, _
   ByVal set As Boolean, _
   ByVal flags As ImapFlags _
) As ImapResponse
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim startIndex As Integer
Dim length As Integer
Dim set As Boolean
Dim flags As ImapFlags
Dim value As ImapResponse

value = instance.Update(startIndex, length, set, flags)
C#
public ImapResponse Update(
   int startIndex,
   int length,
   bool set,
   ImapFlags flags
)
Managed Extensions for C++
public: ImapResponse* Update(
   int startIndex,
   int length,
   bool set,
   ImapFlags flags
)
C++/CLI
public:
ImapResponse^ Update(
   int startIndex,
   int length,
   bool set,
   ImapFlags flags
)

Parameters

startIndex
The first message in the range.
length
The number of messages to set.
set
Use true to add the flags and false to remove them.
flags
ImapFlags value specifying the flag(s) to modify.

Return Value

ImapResponse encapsulating the response from the server.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.
System.ArgumentOutOfRangeException | index was out of range
System.IndexOutOfRangeException | index was outside bounds of array

Remarks

Sets or resets the values of one or more flags on the specified messages. Update can be used to update flags on a single message. Update(ImapMessage[],Boolean,ImapFlags) can be used to update a list of messages.

Example

The following example demonstrates setting the delete flag on a range or set of messages, and optionally deleting them immediately.
C# Copy Code
/// <summary>
/// Sets the delete flag on a range of messages, and optionally deletes them immediately.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance.</param>
/// <param name="startIndex">The index of the first message to delete. Corresponds to the index of the message in myImap.SelectedMailbox.</param>
/// <param name="length">The number of messages after startIndex to delete.</param>
/// <param name="purge">True to delete immediately. False to not delete immediately; wait until logout or a subsequent call to Purge().</param>
public void DeleteMessages(Imap myImap, int startIndex, int length, bool purge)
{
    myImap.SelectedMailbox.Update(startIndex, length, true, ImapFlags.Deleted);

    if (purge)
        myImap.SelectedMailbox.Purge();
}

/// <summary>
/// Sets the delete flag on the specified messages, and optionally deletes them immediately.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance.</param>
/// <param name="messages">An array of messages from myImap.SelectedMailbox to delete.</param>
/// <param name="purge">True to delete immediately. False to not delete immediately; wait until logout or a subsequent call to Purge().</param>
public void DeleteMessages(Imap myImap, ImapMessage[] messages, bool purge)
{
    myImap.SelectedMailbox.Update(messages, true, ImapFlags.Deleted);

    if (purge)
        myImap.SelectedMailbox.Purge();
}
Visual Basic Copy Code
''' <summary>
''' Sets the delete flag on a range of messages, and optionally deletes them immediately.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance.</param>
''' <param name="startIndex">The index of the first message to delete. Corresponds to the index of the message in myImap.SelectedMailbox.</param>
''' <param name="length">The number of messages after startIndex to delete.</param>
''' <param name="purge">True to delete immediately. False to not delete immediately; wait until logout or a subsequent call to Purge().</param>
Public Sub DeleteMessages(ByVal myImap As Imap, ByVal startIndex As Integer, ByVal length As Integer, ByVal purge As Boolean)
    myImap.SelectedMailbox.Update(startIndex, length, True, ImapFlags.Deleted)

    If purge Then
        myImap.SelectedMailbox.Purge()
    End If
End Sub

''' <summary>
''' Sets the delete flag on the specified messages, and optionally deletes them immediately.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance.</param>
''' <param name="messages">An array of messages from myImap.SelectedMailbox to delete.</param>
''' <param name="purge">True to delete immediately. False to not delete immediately; wait until logout or a subsequent call to Purge().</param>
Public Sub DeleteMessages(ByVal myImap As Imap, ByVal messages() As ImapMessage, ByVal purge As Boolean)
    myImap.SelectedMailbox.Update(messages, True, ImapFlags.Deleted)

    If purge Then
        myImap.SelectedMailbox.Purge()
    End If
End Sub

See Also

Reference

Mailbox Class
Mailbox Members
Overload List


Mailbox Class Properties

[image]
PowerTCP Mail for .NET
Mailbox Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Mailbox Class

Glossary Item Box

For a list of all members of this type, see Mailbox members.

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Property | Count | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Property | FirstUnseen | Gets the first unseen message in the mailbox.
Public Property | FullName | Gets or sets the full path name of the mailbox.
Public Property | Imap | Returns the top-level Imap component the Mailbox belongs too.
Public Property | Item | (Inherited from System.Collections.Generic.List<ImapMessage>)
Public Property | Mailboxes | Gets a collection containing all sub-mailboxes in the mailbox.
Public Property | Marked | Gets a value indicating if the mailbox has been "marked."
Public Property | Name | Gets or sets the "short" name of the mailbox, excluding any parent mailbox.
Public Property | Parent | Returns the parent Mailbox in the hierarchy. This is null for root mailboxes.
Public Property | ReadOnly | Gets a value indicating if the mailbox is read-only.
Public Property | Recent | Gets the number of recent messages in the Mailbox.
Public Property | Selectable | Gets a value indicating if the mailbox can be selected.
Public Property | SublevelsAllowed | Gets a value indicating if mailboxes can be created below this mailbox.
Public Property | Tag | Gets or sets an object reference that can be used to associate this instance with any other object.
Top

See Also

Reference

Mailbox Class
Dart.Mail Namespace


FirstUnseen Property

[image]
PowerTCP Mail for .NET
FirstUnseen Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : FirstUnseen Property

Glossary Item Box

Gets the first unseen message in the mailbox.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property FirstUnseen As ImapMessage
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As ImapMessage

value = instance.FirstUnseen
C#
public ImapMessage FirstUnseen {get;}
Managed Extensions for C++
public: __property ImapMessage* get_FirstUnseen();
C++/CLI
public:
property ImapMessage^ FirstUnseen {
   ImapMessage^ get();
}

Property Value

ImapMessage.

Remarks

Returns null if no message is unseen.

See Also

Reference

Mailbox Class
Mailbox Members


FullName Property

[image]
PowerTCP Mail for .NET
FullName Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : FullName Property

Glossary Item Box

Gets or sets the full path name of the mailbox.

Syntax

Visual Basic (Declaration)
Public Property FullName As String
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As String

instance.FullName = value

value = instance.FullName
C#
public string FullName {get; set;}
Managed Extensions for C++
public: __property string* get_FullName();
public: __property void set_FullName(
   string* value
);
C++/CLI
public:
property String^ FullName {
   String^ get();
   void set (    String^ value);
}

Property Value

A string representing the full path name of the mailbox.

Remarks

For example, with a mailbox named:

            "inbox\archives\user"

the Mailbox name-related properties would be as follows:

Property | Value
Mailbox.Name | "user"
Mailbox.FullName | "inbox\archives\user"

When setting this property, a RENAME command is sent to the server. If renaming a sibling mailbox, use Name instead. For example, to rename

            "company/users/bob"

to

            "company/users/bobjohnson"

set Mailbox.Name to "bobjohnson". However, to rename

            "company/users/bob"

to

            "archive/bobbackup"

set Mailbox.FullName to "archive/bobbackup".

"&" is represented when sent as "&-". Anything between an "&" and a "-" is converted to Unicode.

Setting this property closes the selected mailbox by setting SelectedMailbox to null.

See Also

Reference

Mailbox Class
Mailbox Members


Imap Property

[image]
PowerTCP Mail for .NET
Imap Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Imap Property

Glossary Item Box

Returns the top-level Imap component the Mailbox belongs too.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Imap As Imap
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Imap

value = instance.Imap
C#
public Imap Imap {get;}
Managed Extensions for C++
public: __property Imap* get_Imap();
C++/CLI
public:
property Imap^ Imap {
   Imap^ get();
}

See Also

Reference

Mailbox Class
Mailbox Members


Mailboxes Property

[image]
PowerTCP Mail for .NET
Mailboxes Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Mailboxes Property

Glossary Item Box

Gets a collection containing all sub-mailboxes in the mailbox.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Mailboxes As MailboxCollection
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As MailboxCollection

value = instance.Mailboxes
C#
public MailboxCollection Mailboxes {get;}
Managed Extensions for C++
public: __property MailboxCollection* get_Mailboxes();
C++/CLI
public:
property MailboxCollection^ Mailboxes {
   MailboxCollection^ get();
}

Property Value

A MailboxCollection which contains all child mailboxes in the mailbox.

Remarks

Returns a MailboxCollection containing mailboxes falling directly below this mailbox in the hierarchy. MailboxCollection.Refresh must be used to populate this collection before it can be accessed if ImapSession.PopulateMailboxTree is false, or if the desired mailbox was added/renamed by another client since the contents were last updated.

Example

The following example demonstrates navigating into/selecting the specified subfolder/sub-mailbox.
C# Copy Code
/// <summary>
/// Navigates into the subfolder/sub-mailbox specified by 'subfolderPath'.
/// </summary>
/// <param name="myImap">A connected and authenticated Imap instance</param>
/// <param name="subfolderPath">Path to the subfolder from root, delimited by '/' in this snippet.</param>
/// <remarks>
/// Imap.Select() may be used to access the path directly, but it will not populate the surrounding mailbox tree.
/// </remarks>
public void NavigateToSubfolder(Imap myImap, string subfolderPath)
{
    //Separate provided path into each subfolder name
    string[] subfolderNameArray = subfolderPath.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);

    //myImap.Mailboxes will already be populated by myImap.Authenticate(), so set to the first subfolder
    Mailbox currentMailbox = myImap.Mailboxes[subfolderNameArray[0]];

    //Subfolders (currentMailbox.Mailboxes) will not be populated, so start drilling down
    for (int i = 1; i <= subfolderNameArray.Length - 1; i++)
    {
        //If the entire mailbox structure was not populated upon login, refresh it now
        if(!myImap.Session.PopulateMailboxTree)
            currentMailbox.Mailboxes.Refresh();
        currentMailbox = currentMailbox.Mailboxes[subfolderNameArray[i]];
    }

    //Now that the end of the specified path has been reached, select that mailbox
    myImap.SelectedMailbox = currentMailbox;
}
Visual Basic Copy Code
''' <summary>
''' Navigates into the subfolder/sub-mailbox specified by 'subfolderPath'.
''' </summary>
''' <param name="myImap">A connected and authenticated Imap instance</param>
''' <param name="subfolderPath">Path to the subfolder from root, delimited by '/' in this snippet.</param>
''' <remarks>
''' Imap.Select() may be used to access the path directly, but it will not populate the surrounding mailbox tree.
''' </remarks>
Public Sub NavigateToSubfolder(ByVal myImap As Imap, ByVal subfolderPath As String)
    'Separate provided path into each subfolder name
    Dim subfolderNameArray() As String = subfolderPath.Split(New String() { "/" }, StringSplitOptions.RemoveEmptyEntries)

    'myImap.Mailboxes will already be populated by myImap.Authenticate(), so set to the first subfolder
    Dim currentMailbox As Mailbox = myImap.Mailboxes(subfolderNameArray(0))

    'Subfolders (currentMailbox.Mailboxes) will not be populated, so start drilling down
    For i As Integer = 1 To subfolderNameArray.Length - 1
        'If the entire mailbox structure was not populated upon login, refresh it now
        If Not myImap.Session.PopulateMailboxTree Then
            currentMailbox.Mailboxes.Refresh()
        End If
        currentMailbox = currentMailbox.Mailboxes(subfolderNameArray(i))
    Next i

    'Now that the end of the specified path has been reached, select that mailbox
    myImap.SelectedMailbox = currentMailbox
End Sub

See Also

Reference

Mailbox Class
Mailbox Members


Marked Property

[image]
PowerTCP Mail for .NET
Marked Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Marked Property

Glossary Item Box

Gets a value indicating if the mailbox has been "marked."

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Marked As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Boolean

value = instance.Marked
C#
public bool Marked {get;}
Managed Extensions for C++
public: __property bool get_Marked();
C++/CLI
public:
property bool Marked {
   bool get();
}

Property Value

true if the mailbox has been "marked" by the server; false otherwise.

Remarks

This property returns true if the mailbox has been "marked" as interesting by the server. This may occur if the mailbox contains new messages.

See Also

Reference

Mailbox Class
Mailbox Members


Name Property

[image]
PowerTCP Mail for .NET
Name Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Name Property

Glossary Item Box

Gets or sets the "short" name of the mailbox, excluding any parent mailbox.

Syntax

Visual Basic (Declaration)
Public Property Name As String
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As String

instance.Name = value

value = instance.Name
C#
public string Name {get; set;}
Managed Extensions for C++
public: __property string* get_Name();
public: __property void set_Name(
   string* value
);
C++/CLI
public:
property String^ Name {
   String^ get();
   void set (    String^ value);
}

Property Value

A string representing the "short" name of the mailbox.

Remarks

For example, with a mailbox named:

            "inbox\archives\user"

the Mailbox name-related properties would be as follows:

Property | Value
Mailbox.Name | "user"
Mailbox.FullName | "inbox\archives\user"

Setting this property sends a RENAME command to the server. This will only rename the "short" name, which has some limitations. For example, to rename

            "company/users/bob"
to
            "company/users/bobjohnson"
set Mailbox.Name to "bobjohnson". However, to rename
            "company/users/bob"
to
            "archive/bobbackup"
set FullName to "archive/bobbackup".

"&" is represented when sent as "&-". Anything between an "&" and a "-" is converted to Unicode.

Setting this property closes the selected mailbox by setting SelectedMailbox to null.

Example

This example demonstrates how to create, rename and delete a mailbox. It also shows how to subscribe and unsubscribe a mailbox.
C# Copy Code
private void doMailboxFunctions(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Create a mailbox
    Mailbox newBox = imap1.Mailboxes.Add("My_New_Box");

    //Subscribe the mailbox and check the subscribed list
    newBox.Subscribe();
    //Get all subscribed mailboxes
    List<Mailbox> list = imap1.List("", "%", true).ToList<Mailbox>();
    if (!list.Contains(newBox)) throw new Exception("Server did not subscribe the mailbox.");

    //Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe();
    list = imap1.List("", "%", true).ToList<Mailbox>();
    if (list.Contains(newBox)) throw new Exception("Server did not unsubscribe the mailbox.");

    //Rename the mailbox and then delete it
    newBox.Name = newBox.Name + "_Renamed";
    imap1.Mailboxes.Remove(newBox);

    //Gracefully logout of the session
    imap1.Close();
}
Visual Basic Copy Code
Private Sub doMailboxFunctions(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Create a mailbox
    Dim newBox As Mailbox = imap1.Mailboxes.Add("My_New_Box")

    'Subscribe the mailbox and check the subscribed list
    newBox.Subscribe()
    'Get all subscribed mailboxes
    Dim list As List(Of Mailbox) = imap1.List("", "%", True).ToList()
    If Not list.Contains(newBox) Then
        Throw New Exception("Server did not subscribe the mailbox.")
    End If

    'Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe()
    list = imap1.List("", "%", True).ToList()
    If list.Contains(newBox) Then
        Throw New Exception("Server did not unsubscribe the mailbox.")
    End If

    'Rename the mailbox and then delete it
    newBox.Name = newBox.Name & "_Renamed"
    imap1.Mailboxes.Remove(newBox)

    'Gracefully logout of the session
    imap1.Close()
End Sub

See Also

Reference

Mailbox Class
Mailbox Members


Parent Property

[image]
PowerTCP Mail for .NET
Parent Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Parent Property

Glossary Item Box

Returns the parent Mailbox in the hierarchy. This is null for root mailboxes.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Parent As Mailbox
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Mailbox

value = instance.Parent
C#
public Mailbox Parent {get;}
Managed Extensions for C++
public: __property Mailbox* get_Parent();
C++/CLI
public:
property Mailbox^ Parent {
   Mailbox^ get();
}

See Also

Reference

Mailbox Class
Mailbox Members


ReadOnly Property

[image]
PowerTCP Mail for .NET
ReadOnly Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : ReadOnly Property

Glossary Item Box

Gets a value indicating if the mailbox is read-only.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property ReadOnly As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Boolean

value = instance.ReadOnly
C#
public bool ReadOnly {get;}
Managed Extensions for C++
public: __property bool get_ReadOnly();
C++/CLI
public:
property bool ReadOnly {
   bool get();
}

Property Value

true if the mailbox cannot be written to; false otherwise.

Remarks

This property returns true if the mailbox is read-only. True indicates either EXAMINE (instead of SELECT) was used to select the mailbox, or the mailbox is configured to be read-only.

See Also

Reference

Mailbox Class
Mailbox Members


Recent Property

[image]
PowerTCP Mail for .NET
Recent Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Recent Property

Glossary Item Box

Gets the number of recent messages in the Mailbox.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Recent As Integer
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Integer

value = instance.Recent
C#
public int Recent {get;}
Managed Extensions for C++
public: __property int get_Recent();
C++/CLI
public:
property int Recent {
   int get();
}

Property Value

An integer equal to the number of recent messages in the mailbox.

Remarks

This property returns the number of recent messages in the mailbox. Typically, a server considers a message to be "recent" if it was notified of the message's arrival during the current session.

See Also

Reference

Mailbox Class
Mailbox Members


Selectable Property

[image]
PowerTCP Mail for .NET
Selectable Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Selectable Property

Glossary Item Box

Gets a value indicating if the mailbox can be selected.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Selectable As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Boolean

value = instance.Selectable
C#
public bool Selectable {get;}
Managed Extensions for C++
public: __property bool get_Selectable();
C++/CLI
public:
property bool Selectable {
   bool get();
}

Property Value

true if the mailbox can be selected; false otherwise.

Remarks

This property indicates whether the mailbox can be selected. If false, this mailbox cannot be set as the SelectedMailbox.

See Also

Reference

Mailbox Class
Mailbox Members


SublevelsAllowed Property

[image]
PowerTCP Mail for .NET
SublevelsAllowed Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : SublevelsAllowed Property

Glossary Item Box

Gets a value indicating if mailboxes can be created below this mailbox.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property SublevelsAllowed As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Boolean

value = instance.SublevelsAllowed
C#
public bool SublevelsAllowed {get;}
Managed Extensions for C++
public: __property bool get_SublevelsAllowed();
C++/CLI
public:
property bool SublevelsAllowed {
   bool get();
}

Property Value

true if additional mailboxes can be created in the hierarchy below this mailbox; otherwise false.

Remarks

If this property is false, any attempts to create mailboxes as children of this mailbox will result in an error.

See Also

Reference

Mailbox Class
Mailbox Members


Tag Property

[image]
PowerTCP Mail for .NET
Tag Property
See Also Send comments on this topic
Dart.Mail Namespace > Mailbox Class : Tag Property

Glossary Item Box

Gets or sets an object reference that can be used to associate this instance with any other object.

Syntax

Visual Basic (Declaration)
Public Property Tag As Object
Visual Basic (Usage) Copy Code
Dim instance As Mailbox
Dim value As Object

instance.Tag = value

value = instance.Tag
C#
public object Tag {get; set;}
Managed Extensions for C++
public: __property Object* get_Tag();
public: __property void set_Tag(
   Object* value
);
C++/CLI
public:
property Object^ Tag {
   Object^ get();
   void set (    Object^ value);
}

Property Value

Any object that is associated with the object, null if no objects are associated with the object.

Remarks

See Also

Reference

Mailbox Class
Mailbox Members


MailboxCollection Class

[image]
PowerTCP Mail for .NET
MailboxCollection Class
Members See Also Send comments on this topic
Dart.Mail Namespace : MailboxCollection Class

Glossary Item Box

A List of Mailbox objects sorted by Mailbox.Name.

Object Model

MailboxCollection ClassMailbox Class

Syntax

Visual Basic (Declaration)
Public Class MailboxCollection
   Inherits System.Collections.Generic.List(Of Mailbox)
Visual Basic (Usage) Copy Code
Dim instance As MailboxCollection
C#
public class MailboxCollection : System.Collections.Generic.List<Mailbox>
Managed Extensions for C++
public __gc class MailboxCollection : public System.Collections.Generic.List<Mailbox>
C++/CLI
public ref class MailboxCollection : public System.Collections.Generic.List<Mailbox>

Remarks

Contains a list of Mailbox objects that exist on an IMAP server. It is seen as Mailboxes and Mailbox.Mailboxes.

This class can be manipulated by using Add(String) and Remove. Since this is a client-side collection, calling these methods sends the associated IMAP command to the server. For example, Remove sends a DELETE command to the server. If any method called results in the addition, deletion, or modification of a mailbox, it will automatically update to reflect the state of the server.

Inheritance Hierarchy

System.Object
System.Collections.Generic.List<T>
Dart.Mail.MailboxCollection

See Also

Reference

MailboxCollection Members
Dart.Mail Namespace


MailboxCollection Class Members

[image]
PowerTCP Mail for .NET
MailboxCollection Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : MailboxCollection Class

Glossary Item Box

The following tables list the members exposed by MailboxCollection.

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Property | Count | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Property | Item | Gets the Mailbox with the specified name.
Top

Public Methods

 | Name | Description
Public Method | Add | Overloaded. Add a new mailbox to the collection.
Public Method | AddRange | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Clear | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Contains | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Exists | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Find(Predicate{Mailbox}) | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | GetRange | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Insert | Not supported.
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Refresh | Refreshes the list of mailboxes.
Public Method | Remove | Remove a mailbox from the collection.
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | RemoveAt | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | ToArray | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<Mailbox>)
Top

See Also

Reference

MailboxCollection Class
Dart.Mail Namespace


MailboxCollection Class Methods

[image]
PowerTCP Mail for .NET
MailboxCollection Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : MailboxCollection Class

Glossary Item Box

For a list of all members of this type, see MailboxCollection members.

Public Methods

 | Name | Description
Public Method | Add | Overloaded. Add a new mailbox to the collection.
Public Method | AddRange | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Clear | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Contains | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Exists | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Find(Predicate{Mailbox}) | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | GetRange | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Insert | Not supported.
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Refresh | Refreshes the list of mailboxes.
Public Method | Remove | Remove a mailbox from the collection.
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | RemoveAt | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | ToArray | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<Mailbox>)
Top

See Also

Reference

MailboxCollection Class
Dart.Mail Namespace


Add Method

[image]
PowerTCP Mail for .NET
Add Method
See Also Send comments on this topic
Dart.Mail Namespace > MailboxCollection Class : Add Method

Glossary Item Box

Add a new mailbox to the collection.

Overload List

Overload | Description
Add(String) | Add a new mailbox to the collection.
Add(Mailbox) | (Inherited from System.Collections.Generic.List<Mailbox>)

See Also

Reference

MailboxCollection Class
MailboxCollection Members


Add(String) Method

[image]
PowerTCP Mail for .NET
Add(String) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailboxCollection Class > Add Method : Add(String) Method

name
The name of the new mailbox.

Glossary Item Box

Add a new mailbox to the collection.

Syntax

Visual Basic (Declaration)
Public Overloads Function Add( _
   ByVal name As String _
) As Mailbox
Visual Basic (Usage) Copy Code
Dim instance As MailboxCollection
Dim name As String
Dim value As Mailbox

value = instance.Add(name)
C#
public Mailbox Add(
   string name
)
Managed Extensions for C++
public: Mailbox* Add(
   string* name
)
C++/CLI
public:
Mailbox^ Add(
   String^ name
)

Parameters

name
The name of the new mailbox.

Return Value

A Mailbox object representing the newly added mailbox.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | The requested address is not valid in its context.
System.InvalidOperationException | Attempt to illegally modify a server-side collection.

Remarks

Creates a new mailbox on the server with the specified name by sending the IMAP CREATE command. The new mailbox will be created under the currently selected (parent) mailbox. If there is no parent for this mailbox, the new mailbox will be a top-level mailbox.

After calling this method, the MailboxCollection will be automatically updated to reflect the current state of the collection.

Example

This example demonstrates how to create, rename and delete a mailbox. It also shows how to subscribe and unsubscribe a mailbox.
C# Copy Code
private void doMailboxFunctions(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Create a mailbox
    Mailbox newBox = imap1.Mailboxes.Add("My_New_Box");

    //Subscribe the mailbox and check the subscribed list
    newBox.Subscribe();
    //Get all subscribed mailboxes
    List<Mailbox> list = imap1.List("", "%", true).ToList<Mailbox>();
    if (!list.Contains(newBox)) throw new Exception("Server did not subscribe the mailbox.");

    //Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe();
    list = imap1.List("", "%", true).ToList<Mailbox>();
    if (list.Contains(newBox)) throw new Exception("Server did not unsubscribe the mailbox.");

    //Rename the mailbox and then delete it
    newBox.Name = newBox.Name + "_Renamed";
    imap1.Mailboxes.Remove(newBox);

    //Gracefully logout of the session
    imap1.Close();
}
Visual Basic Copy Code
Private Sub doMailboxFunctions(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Create a mailbox
    Dim newBox As Mailbox = imap1.Mailboxes.Add("My_New_Box")

    'Subscribe the mailbox and check the subscribed list
    newBox.Subscribe()
    'Get all subscribed mailboxes
    Dim list As List(Of Mailbox) = imap1.List("", "%", True).ToList()
    If Not list.Contains(newBox) Then
        Throw New Exception("Server did not subscribe the mailbox.")
    End If

    'Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe()
    list = imap1.List("", "%", True).ToList()
    If list.Contains(newBox) Then
        Throw New Exception("Server did not unsubscribe the mailbox.")
    End If

    'Rename the mailbox and then delete it
    newBox.Name = newBox.Name & "_Renamed"
    imap1.Mailboxes.Remove(newBox)

    'Gracefully logout of the session
    imap1.Close()
End Sub

See Also

Reference

MailboxCollection Class
MailboxCollection Members
Overload List


Insert Method

[image]
PowerTCP Mail for .NET
Insert Method
See Also Send comments on this topic
Dart.Mail Namespace > MailboxCollection Class : Insert Method

index
Index at which the item is to be added.
item
Mailbox instance.

Glossary Item Box

Not supported.

Syntax

Visual Basic (Declaration)
Public Shadows Sub Insert( _
   ByVal index As Integer, _
   ByVal item As Mailbox _
)
Visual Basic (Usage) Copy Code
Dim instance As MailboxCollection
Dim index As Integer
Dim item As Mailbox

instance.Insert(index, item)
C#
public new void Insert(
   int index,
   Mailbox item
)
Managed Extensions for C++
public: new void Insert(
   int index,
   Mailbox* item
)
C++/CLI
public:
new void Insert(
   int index,
   Mailbox^ item
)

Parameters

index
Index at which the item is to be added.
item
Mailbox instance.

Exceptions

Exception | Description
System.InvalidOperationException | Use Add(String) to add a new mailbox to the server.

See Also

Reference

MailboxCollection Class
MailboxCollection Members


Refresh Method

[image]
PowerTCP Mail for .NET
Refresh Method
See Also Send comments on this topic
Dart.Mail Namespace > MailboxCollection Class : Refresh Method

Glossary Item Box

Refreshes the list of mailboxes.

Syntax

Visual Basic (Declaration)
Public Sub Refresh()
Visual Basic (Usage) Copy Code
Dim instance As MailboxCollection

instance.Refresh()
C#
public void Refresh()
Managed Extensions for C++
public: void Refresh();
C++/CLI
public:
void Refresh();

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.

Remarks

Only "root" mailboxes are initialized by default (by Authenticate. Use this method to populate all sub-mailboxes.

See Also

Reference

MailboxCollection Class
MailboxCollection Members


Remove Method

[image]
PowerTCP Mail for .NET
Remove Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailboxCollection Class : Remove Method

value
The Mailbox object to remove.

Glossary Item Box

Remove a mailbox from the collection.

Syntax

Visual Basic (Declaration)
Public Shadows Sub Remove( _
   ByVal value As Mailbox _
)
Visual Basic (Usage) Copy Code
Dim instance As MailboxCollection
Dim value As Mailbox

instance.Remove(value)
C#
public new void Remove(
   Mailbox value
)
Managed Extensions for C++
public: new void Remove(
   Mailbox* value
)
C++/CLI
public:
new void Remove(
   Mailbox^ value
)

Parameters

value
The Mailbox object to remove.

Exceptions

Exception | Description
ProtocolException | Bad IMAP protocol response received from server.
System.Net.Sockets.SocketException | A communications failure has occurred.
System.InvalidOperationException | Attempt to illegally modify a server-side collection.

Remarks

This method removes the specified mailbox from the server by sending the IMAP DELETE command.

The list is automatically updated to reflect the new state of the collection.

Example

This example demonstrates how to create, rename and delete a mailbox. It also shows how to subscribe and unsubscribe a mailbox.
C# Copy Code
private void doMailboxFunctions(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Create a mailbox
    Mailbox newBox = imap1.Mailboxes.Add("My_New_Box");

    //Subscribe the mailbox and check the subscribed list
    newBox.Subscribe();
    //Get all subscribed mailboxes
    List<Mailbox> list = imap1.List("", "%", true).ToList<Mailbox>();
    if (!list.Contains(newBox)) throw new Exception("Server did not subscribe the mailbox.");

    //Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe();
    list = imap1.List("", "%", true).ToList<Mailbox>();
    if (list.Contains(newBox)) throw new Exception("Server did not unsubscribe the mailbox.");

    //Rename the mailbox and then delete it
    newBox.Name = newBox.Name + "_Renamed";
    imap1.Mailboxes.Remove(newBox);

    //Gracefully logout of the session
    imap1.Close();
}
Visual Basic Copy Code
Private Sub doMailboxFunctions(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Create a mailbox
    Dim newBox As Mailbox = imap1.Mailboxes.Add("My_New_Box")

    'Subscribe the mailbox and check the subscribed list
    newBox.Subscribe()
    'Get all subscribed mailboxes
    Dim list As List(Of Mailbox) = imap1.List("", "%", True).ToList()
    If Not list.Contains(newBox) Then
        Throw New Exception("Server did not subscribe the mailbox.")
    End If

    'Unsubscribe the mailbox and check the subscribed list
    newBox.Unsubscribe()
    list = imap1.List("", "%", True).ToList()
    If list.Contains(newBox) Then
        Throw New Exception("Server did not unsubscribe the mailbox.")
    End If

    'Rename the mailbox and then delete it
    newBox.Name = newBox.Name & "_Renamed"
    imap1.Mailboxes.Remove(newBox)

    'Gracefully logout of the session
    imap1.Close()
End Sub

See Also

Reference

MailboxCollection Class
MailboxCollection Members


MailboxCollection Class Properties

[image]
PowerTCP Mail for .NET
MailboxCollection Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : MailboxCollection Class

Glossary Item Box

For a list of all members of this type, see MailboxCollection members.

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Property | Count | (Inherited from System.Collections.Generic.List<Mailbox>)
Public Property | Item | Gets the Mailbox with the specified name.
Top

See Also

Reference

MailboxCollection Class
Dart.Mail Namespace


Item Property

[image]
PowerTCP Mail for .NET
Item Property
See Also Send comments on this topic
Dart.Mail Namespace > MailboxCollection Class : Item Property

name
The case-sensitive mailbox name to search for.

Glossary Item Box

Gets the Mailbox with the specified name.

Syntax

Visual Basic (Declaration)
Public Shadows ReadOnly Default Property Item( _
   ByVal name As String _
) As Mailbox
Visual Basic (Usage) Copy Code
Dim instance As MailboxCollection
Dim name As String
Dim value As Mailbox

value = instance.Item(name)
C#
public new Mailbox this[
   string name
]; {get;}
Managed Extensions for C++
public: __property new Mailbox* get_Item   string* name
;
C++/CLI
public:
new property Mailbox^ default [String^] {
   Mailbox^ get(String^ name);
}

Parameters

name
The case-sensitive mailbox name to search for.

Property Value

A Mailbox object or null if no match is found.

Remarks

This method performs a linear search, returning a Mailbox if Mailbox.Name equals name.

See Also

Reference

MailboxCollection Class
MailboxCollection Members


MailMessage Class

[image]
PowerTCP Mail for .NET
MailMessage Class
Members See Also Send comments on this topic
Dart.Mail Namespace : MailMessage Class

Glossary Item Box

PowerTCP object model of an RFC 822 email message.

Object Model

MailMessage ClassContentType ClassHeaderDictionary ClassHeaderField ClassMultipartContent ClassPart Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class MailMessage
   Inherits Multipart
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
C#
[Serializable()]
public class MailMessage : Multipart
Managed Extensions for C++
[Serializable()]
public __gc class MailMessage : public Multipart
C++/CLI
[Serializable()]
public ref class MailMessage : public Multipart

Remarks

If MailMessage.Parts.Count = 1, the headers of that part will merge with MailMessage.Headers during encoding (also affects MailMessage.ContentType), with Part.Headers favored for any collisions.

Inheritance Hierarchy

System.Object
Dart.Mail.Part
Dart.Mail.Multipart
Dart.Mail.MailMessage

See Also

Reference

MailMessage Members
Dart.Mail Namespace


MailMessage Class Members

[image]
PowerTCP Mail for .NET
MailMessage Class Members
See Also Fields Properties Methods Send comments on this topic
Dart.Mail Namespace : MailMessage Class

Glossary Item Box

The following tables list the members exposed by MailMessage.

Public Constructors

 | Name | Description
Public Constructor | MailMessage Constructor | Overloaded.
Top

Public Fields

 | Name | Description
static (Shared in Visual Basic) | MaxEncodedLineLength | The maximum length for an encoded email line. Header lines are "folded" IAW RFC 2822. Body text will have CR/LF's inserted between encoded characters.
Top

Public Properties

 | Name | Description
Public Property | Attachments | Get a generic List containing all the Attachments within this part and sub-parts. (Inherited from Dart.Mail.Multipart)
Public Property | Bcc | Gets or sets the email address(es) of the "blind carbon-copy" recipient(s).
Public Property | BitEncoding | Gets the bit encoding of the message (SevenBit, EightBit, or Binary only).
Public Property | Cc | Gets or sets the email address(es) of the "carbon-copy" recipient(s).
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Date | Gets and sets the "Date:" header field.
Public Property | From | Gets or sets the email address of who the email is from.
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Html | Gets or sets the HTML text body. (Inherited from Dart.Mail.Multipart)
Public Property | IsMime | Gets or sets a value that controls the use of MIME encoding.
Public Property | IsSecure | Returns false if SecureEncoding is SecureEncoding.None, otherwise true.
Public Property | Length | Returns the approximate Length of the encoded part. (Inherited from Dart.Mail.Multipart)
Public Property | Parts | A Part list that contains all the parts in the Multipart. (Inherited from Dart.Mail.Multipart)
Public Property | Priority | Gets or sets the Priority of the message.
Public Property | ReplyTo | Gets or sets the email address(es) of where any reply should be sent.
Public Property | Resources | Get a generic List containing all the Resources within this part and sub-parts. (Inherited from Dart.Mail.Multipart)
Public Property | SecureEncoding | Indicates the type of S/MIME encoding exposed by the header. Any "inner" encoding is unknown.
Public Property | Sender | Gets or sets the email address of the sender of the email.
Public Property | Subject | Gets or sets the value of the "Subject" header field.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | Text | Gets or sets the plain text body. (Inherited from Dart.Mail.Multipart)
Public Property | To | Gets or sets the email address(es) of the primary recipient(s).
Top

Public Methods

 | Name | Description
Public Method | Clear | Overridden. Reinitializes the MailMessage to default values. IsMime is set to true. Date is set to DateTime.Now.
Public Method | Clone | Overridden. Creates a deep copy of the MailMessage, but deep/shallow copies of its Parts. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.
Public Method | Dispose | Overloaded. Releases all resources associated with the object. (Inherited from Dart.Mail.Multipart)
Public Method | FindHtml | Finds the first Htmlpart, recursively searching Multipart.Parts (depth before breadth). (Inherited from Dart.Mail.Multipart)
Public Method | FindParent | Performs a recursive search to find the "parent" Part of the specified child within this Multipart. (Inherited from Dart.Mail.Multipart)
Public Method | FindText | Finds the first Textpart, recursively searching Multipart.Parts (depth before breadth). (Inherited from Dart.Mail.Multipart)
Public Method | Forward | Creates a forwarded Message.
Public Method | GetContentEncodingStream | Overridden. Used to encode message content.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetObjectData | This method supports the .NET infrastructure and is not meant to be called directly from your code.
Public Method | Open | Overloaded. Decodes the provided Stream and populates the Part.
Public Method | Reply | Creates a reply message by inserting a new Textpart. Leaves the original parts unmodified.
Public Method | ReplyAll | Creates a reply message by inserting a new Textpart. Leaves the original parts unmodified. Replies to the sender and CC's all recipients.
Public Method | ReplyAllInline | Creates a reply message by prepending the reply text/HTML and separators to the original text/HTML. Replies to the sender and CC's all recipients.
Public Method | ReplyInline | Creates a reply message by prepending the reply text/HTML and separators to the original text/HTML.
Public Method | Save | Overloaded. Encodes the MIME entity and saves it to the specified stream.
Public Method | SecureDecode | Overloaded. Decode the S/MIME encoded MailMessage.
Public Method | SecureEncrypt | Overloaded. Encrypt the MailMessage using S/MIME encoding.
Public Method | SecureSign | Overloaded. Sign the MailMessage using S/MIME encoding.
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

MailMessage Class
Dart.Mail Namespace


MailMessage Constructor

[image]
PowerTCP Mail for .NET
MailMessage Constructor
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : MailMessage Constructor

Glossary Item Box

Overload List

Overload | Description
MailMessage Constructor() | Creates an empty MailMessage for subsequent decoding (receiving) or encoding (sending).
MailMessage Constructor(SerializationInfo,StreamingContext) | Deserialization constructor.
MailMessage Constructor(MailMessage) | Used to convert from the .NET System.Net.Mail.MailMessage object to a MailMessage for subsequent encoding and sending using Smtp.
MailMessage Constructor(String,String,FileInfo[]) | Initializes Parts with new Textpart, Htmlpart and linked Resource parts.
MailMessage Constructor(String) | Decodes the provided ASCII string and populates the new message.
MailMessage Constructor(Stream) | Decodes the provided bytes and populates the new message.

See Also

Reference

MailMessage Class
MailMessage Members


MailMessage Constructor()

[image]
PowerTCP Mail for .NET
MailMessage Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class > MailMessage Constructor : MailMessage Constructor()

Glossary Item Box

Creates an empty MailMessage for subsequent decoding (receiving) or encoding (sending).

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New MailMessage()
C#
public MailMessage()
Managed Extensions for C++
public: MailMessage();
C++/CLI
public:
MailMessage();

Remarks

The Headers is initialized to common default values. These are removed and replaced with a decoded Header if the object is used for decoding.

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


MailMessage Constructor(SerializationInfo,StreamingContext)

[image]
PowerTCP Mail for .NET
MailMessage Constructor(SerializationInfo,StreamingContext)
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class > MailMessage Constructor : MailMessage Constructor(SerializationInfo,StreamingContext)

info
Serialization information.
context
Streaming context.

Glossary Item Box

Deserialization constructor.

Syntax

Visual Basic (Declaration)
Protected Function New( _
   ByVal info As SerializationInfo, _
   ByVal context As StreamingContext _
)
Visual Basic (Usage) Copy Code
Dim info As SerializationInfo
Dim context As StreamingContext

Dim instance As New MailMessage(info, context)
C#
protected MailMessage(
   SerializationInfo info,
   StreamingContext context
)
Managed Extensions for C++
protected: MailMessage(
   SerializationInfo* info,
   StreamingContext context
)
C++/CLI
protected:
MailMessage(
   SerializationInfo^ info,
   StreamingContext context
)

Parameters

info
Serialization information.
context
Streaming context.

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


MailMessage Constructor(MailMessage)

[image]
PowerTCP Mail for .NET
MailMessage Constructor(MailMessage)
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class > MailMessage Constructor : MailMessage Constructor(MailMessage)

message
The System.Net.Mail.MailMessage to use to populate this Dart.Mail.MailMessage.

Glossary Item Box

Used to convert from the .NET System.Net.Mail.MailMessage object to a MailMessage for subsequent encoding and sending using Smtp.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal message As MailMessage _
)
Visual Basic (Usage) Copy Code
Dim message As MailMessage

Dim instance As New MailMessage(message)
C#
public MailMessage(
   MailMessage message
)
Managed Extensions for C++
public: MailMessage(
   MailMessage* message
)
C++/CLI
public:
MailMessage(
   MailMessage^ message
)

Parameters

message
The System.Net.Mail.MailMessage to use to populate this Dart.Mail.MailMessage.

Remarks

The method provides a path for users who are upgrading to PowerTCP Mail for .NET from System.Net.Mail.

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


MailMessage Constructor(String,String,FileInfo[])

[image]
PowerTCP Mail for .NET
MailMessage Constructor(String,String,FileInfo[])
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class > MailMessage Constructor : MailMessage Constructor(String,String,FileInfo[])

text
Used to initialize Multipart.Text (Parts[0]). If null or empty no Textpart is created.
html
Used to initialize Multipart.Html (Parts[1]). If null or empty an ArgumentNullException is thrown.
htmlResources
Used to initialized a "multipart/related" part (Parts[1]) that provides linked embedded resources referenced by Multipart.Html.

Glossary Item Box

Initializes Parts with new Textpart, Htmlpart and linked Resource parts.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal text As String, _
   ByVal html As String, _
   ByVal htmlResources() As FileInfo _
)
Visual Basic (Usage) Copy Code
Dim text As String
Dim html As String
Dim htmlResources() As FileInfo

Dim instance As New MailMessage(text, html, htmlResources)
C#
public MailMessage(
   string text,
   string html,
   FileInfo[] htmlResources
)
Managed Extensions for C++
public: MailMessage(
   string* text,
   string* html,
   FileInfo*[]* htmlResources
)
C++/CLI
public:
MailMessage(
   String^ text,
   String^ html,
   array<FileInfo^>^ htmlResources
)

Parameters

text
Used to initialize Multipart.Text (Parts[0]). If null or empty no Textpart is created.
html
Used to initialize Multipart.Html (Parts[1]). If null or empty an ArgumentNullException is thrown.
htmlResources
Used to initialized a "multipart/related" part (Parts[1]) that provides linked embedded resources referenced by Multipart.Html.

Exceptions

Exception | Description
System.ArgumentException | htmlResources missing reference to an HTML link.
System.ArgumentNullException | html cannot be null or empty.

Remarks

This constructor is used to create HTML email. "multipart/alternative" and/or "multipart/related" parts are created to represent the parameters provided.

If text is null or empty, then html and htmlResources are used to create either a "text/html" part or a "multipart/related" part that contains a "text/html" part. Otherwise, Part.ContentType is set to "multipart/alternative" and 2 parts are created and saved in Parts.

If htmlResources is null, then html is represented as a single Htmlpart. Otherwise, a new "multipart/related" Multipart is created and initialized with html and linked htmlResources.

Example

This example demonstrates creating a new MailMessage and populating it with HTML that references local files, such as a "Webpage, complete (*.htm;*.html)" as saved by Internet Explorer.
C# Copy Code
private MailMessage getMessageFromHtml(string pathToHtml, string pathToHtmlResources, string from, string to, string subject, bool includeTextPlain)
{
    //Note: to load a .mht (Mime HTML) file, use MailMessage.Open() instead.

    //Load HTML
    string html;
    using (StreamReader sr = new StreamReader(pathToHtml))
        html = sr.ReadToEnd();

    //Initialize a MailMessage object. includeTextPlain controls whether the message should include a text/plain part
    //(which determines whether the message is multipart/alternative (when true) or multipart/related (when false))
    string textPlain = (includeTextPlain) ? "text/plain representation of included HTML" : null;
    MailMessage mailMsg = new MailMessage(textPlain, html, new DirectoryInfo(pathToHtmlResources).GetFiles());

    //Set sender, recipients and subject
    mailMsg.From = from;
    mailMsg.To = to;
    mailMsg.Subject = subject;
    return mailMsg;
}
Visual Basic Copy Code
Private Function getMessageFromHtml(ByVal pathToHtml As String, ByVal fromAddress As String, ByVal toAddress As String, ByVal subject As String) As MailMessage
     'Note: to load a .mht (Mime HTML) file, use MailMessage.Open() instead.

     'Load HTML
     Dim sr As New StreamReader(pathToHtml)
     Dim html As String = sr.ReadToEnd()
     sr.Close()

     'Initialize a MailMessage object. includeTextPlain controls whether the message should include a
     'text/plain part (which determines whether the message is multipart/alternative (when true) or multipart/related (when false))
     Dim textPlain As String = If(includeTextPlain, "text/plain representation of included HTML", Nothing)
     Dim mailMsg As New MailMessage(textPlain, html, New DirectoryInfo(pathToHtmlResources).GetFiles())

     'Set sender, recipients and subject
     mailMsg.From = fromAddress
     mailMsg.To = toAddress
     mailMsg.Subject = subject
     Return mailMsg
End Function

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


MailMessage Constructor(String)

[image]
PowerTCP Mail for .NET
MailMessage Constructor(String)
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class > MailMessage Constructor : MailMessage Constructor(String)

encodedMessage
Encoded message as an ASCII string.

Glossary Item Box

Decodes the provided ASCII string and populates the new message.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal encodedMessage As String _
)
Visual Basic (Usage) Copy Code
Dim encodedMessage As String

Dim instance As New MailMessage(encodedMessage)
C#
public MailMessage(
   string encodedMessage
)
Managed Extensions for C++
public: MailMessage(
   string* encodedMessage
)
C++/CLI
public:
MailMessage(
   String^ encodedMessage
)

Parameters

encodedMessage
Encoded message as an ASCII string.

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


MailMessage Constructor(Stream)

[image]
PowerTCP Mail for .NET
MailMessage Constructor(Stream)
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class > MailMessage Constructor : MailMessage Constructor(Stream)

encodedMessage
Encoded message as bytes.

Glossary Item Box

Decodes the provided bytes and populates the new message.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal encodedMessage As Stream _
)
Visual Basic (Usage) Copy Code
Dim encodedMessage As Stream

Dim instance As New MailMessage(encodedMessage)
C#
public MailMessage(
   Stream encodedMessage
)
Managed Extensions for C++
public: MailMessage(
   Stream* encodedMessage
)
C++/CLI
public:
MailMessage(
   Stream^ encodedMessage
)

Parameters

encodedMessage
Encoded message as bytes.

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


MailMessage Class Methods

[image]
PowerTCP Mail for .NET
MailMessage Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : MailMessage Class

Glossary Item Box

For a list of all members of this type, see MailMessage members.

Public Methods

 | Name | Description
Public Method | Clear | Overridden. Reinitializes the MailMessage to default values. IsMime is set to true. Date is set to DateTime.Now.
Public Method | Clone | Overridden. Creates a deep copy of the MailMessage, but deep/shallow copies of its Parts. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.
Public Method | Dispose | Overloaded. Releases all resources associated with the object. (Inherited from Dart.Mail.Multipart)
Public Method | FindHtml | Finds the first Htmlpart, recursively searching Multipart.Parts (depth before breadth). (Inherited from Dart.Mail.Multipart)
Public Method | FindParent | Performs a recursive search to find the "parent" Part of the specified child within this Multipart. (Inherited from Dart.Mail.Multipart)
Public Method | FindText | Finds the first Textpart, recursively searching Multipart.Parts (depth before breadth). (Inherited from Dart.Mail.Multipart)
Public Method | Forward | Creates a forwarded Message.
Public Method | GetContentEncodingStream | Overridden. Used to encode message content.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetObjectData | This method supports the .NET infrastructure and is not meant to be called directly from your code.
Public Method | Open | Overloaded. Decodes the provided Stream and populates the Part.
Public Method | Reply | Creates a reply message by inserting a new Textpart. Leaves the original parts unmodified.
Public Method | ReplyAll | Creates a reply message by inserting a new Textpart. Leaves the original parts unmodified. Replies to the sender and CC's all recipients.
Public Method | ReplyAllInline | Creates a reply message by prepending the reply text/HTML and separators to the original text/HTML. Replies to the sender and CC's all recipients.
Public Method | ReplyInline | Creates a reply message by prepending the reply text/HTML and separators to the original text/HTML.
Public Method | Save | Overloaded. Encodes the MIME entity and saves it to the specified stream.
Public Method | SecureDecode | Overloaded. Decode the S/MIME encoded MailMessage.
Public Method | SecureEncrypt | Overloaded. Encrypt the MailMessage using S/MIME encoding.
Public Method | SecureSign | Overloaded. Sign the MailMessage using S/MIME encoding.
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

MailMessage Class
Dart.Mail Namespace


Clear Method

[image]
PowerTCP Mail for .NET
Clear Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Clear Method

Glossary Item Box

Reinitializes the MailMessage to default values. IsMime is set to true. Date is set to DateTime.Now.

Syntax

Visual Basic (Declaration)
Public Overrides Sub Clear()
Visual Basic (Usage) Copy Code
Dim instance As MailMessage

instance.Clear()
C#
public override void Clear()
Managed Extensions for C++
public: void Clear(); override
C++/CLI
public:
void Clear(); override

See Also

Reference

MailMessage Class
MailMessage Members


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Clone Method

Glossary Item Box

Creates a deep copy of the MailMessage, but deep/shallow copies of its Parts. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.

Syntax

Visual Basic (Declaration)
Public Overrides Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As Object

value = instance.Clone()
C#
public override object Clone()
Managed Extensions for C++
public: Object* Clone(); override
C++/CLI
public:
Object^ Clone(); override

Return Value

A MailMessage.

Remarks

Note: Calling Dispose() on the original or cloned MailMessage will dispose of any shallow-copied parts that the original and clone reference.

Example

This example demonstrates how to create a custom reply message. The reply text is followed by some header fields and the text from the original message.
C# Copy Code
private MailMessage createCustomReplyMessage(MailMessage originalMessage, string replyText, string fromAddress)
{
    //Clone the original message
    MailMessage replyMessage = originalMessage.Clone() as MailMessage;

    //Set the recipient address
    if (!String.IsNullOrWhiteSpace(replyMessage.ReplyTo))
        replyMessage.To = replyMessage.ReplyTo;
    else if (!String.IsNullOrWhiteSpace(replyMessage.From))
        replyMessage.To = replyMessage.From;

    //Set the sender's address
    replyMessage.From = fromAddress;

    //Indicate that this is a reply in the subject
    replyMessage.Subject = "Re: " + originalMessage.Subject;

    //Clear some properties of the message
    replyMessage.ReplyTo = "";
    replyMessage.Cc = "";
    replyMessage.Sender = "";

    //Set the message text to be the reply followed by some of the original
    //message's header fields and the original text
    string messageText = replyText + Environment.NewLine + Environment.NewLine;
    messageText += "From: " + originalMessage.From + Environment.NewLine;
    messageText += "Sent: " + originalMessage.Date.ToString() + Environment.NewLine;
    messageText += "To: " + originalMessage.To + Environment.NewLine;
    messageText += "Subject: " + originalMessage.Subject + Environment.NewLine + Environment.NewLine;

    //Set the plain text
    replyMessage.Text = messageText + originalMessage.Text;

    //Set the HTML text
    string html = originalMessage.Html;

    //Locate place in HTML string to insert reply text
    int textStartIndex = html.ToLower().IndexOf("<body");
    if (textStartIndex == -1)
        textStartIndex = html.ToLower().IndexOf("<html");
    textStartIndex = html.IndexOf(">", textStartIndex) + 1;

    //Insert reply text into HTML string and set the Body.Html
    messageText = "<div style=\"color:black\">" + messageText.Replace("\r\n", "<br />") + "</div>";
    html = html.Insert(textStartIndex, messageText);
    replyMessage.Html = html;
    return replyMessage;
}
Visual Basic Copy Code
Private Function createCustomReplyMessage(ByVal originalMessage As MailMessage, ByVal replyText As String, ByVal fromAddress As String) As MailMessage
    'Clone the original message
    Dim replyMessage As MailMessage = TryCast(originalMessage.Clone(), MailMessage)

    'Set the recipient address
    If Not String.IsNullOrWhiteSpace(replyMessage.ReplyTo) Then
        replyMessage.To = replyMessage.ReplyTo
    ElseIf Not String.IsNullOrWhiteSpace(replyMessage.From) Then
        replyMessage.To = replyMessage.From
    End If

    'Set the sender's address
    replyMessage.From = fromAddress

    'Indicate that this is a reply in the subject
    replyMessage.Subject = "Re: " & originalMessage.Subject

    'Clear some properties of the message
    replyMessage.ReplyTo = ""
    replyMessage.Cc = ""
    replyMessage.Sender = ""

    'Set the message text to be the reply followed by some of the original
    'message's header fields and the original text
    Dim messageText As String = replyText & Environment.NewLine & Environment.NewLine
    messageText &= "From: " & originalMessage.From & Environment.NewLine
    messageText &= "Sent: " & originalMessage.Date.ToString() & Environment.NewLine
    messageText &= "To: " & originalMessage.To & Environment.NewLine
    messageText &= "Subject: " & originalMessage.Subject & Environment.NewLine & Environment.NewLine

    'Set the plain text
    replyMessage.Text = messageText & originalMessage.Text

    'Set the HTML text
    Dim html As String = originalMessage.Html

    'Locate place in HTML string to insert reply text
    Dim textStartIndex As Integer = html.ToLower().IndexOf("<body")
    If textStartIndex = -1 Then
        textStartIndex = html.ToLower().IndexOf("<html")
    End If
    textStartIndex = html.IndexOf(">", textStartIndex) + 1

    'Insert reply text into HTML string and set the Body.Html
    messageText = "<div style=""color:black"">" & messageText.Replace(vbCrLf, "<br />") & "</div>"
    html = html.Insert(textStartIndex, messageText)
    replyMessage.Html = html
    Return replyMessage
End Function

See Also

Reference

MailMessage Class
MailMessage Members


Forward Method

[image]
PowerTCP Mail for .NET
Forward Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Forward Method

from
Address used for From.
to
Address used for To.
comment
Text to prepend to the message, added as specified by the format argument.
format
The desired ForwardFormat.

Glossary Item Box

Creates a forwarded Message.

Syntax

Visual Basic (Declaration)
Public Function Forward( _
   ByVal from As String, _
   ByVal to As String, _
   ByVal comment As String, _
   ByVal format As ForwardFormat _
) As MailMessage
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim from As String
Dim to As String
Dim comment As String
Dim format As ForwardFormat
Dim value As MailMessage

value = instance.Forward(from, to, comment, format)
C#
public MailMessage Forward(
   string from,
   string to,
   string comment,
   ForwardFormat format
)
Managed Extensions for C++
public: MailMessage* Forward(
   string* from,
   string* to,
   string* comment,
   ForwardFormat format
)
C++/CLI
public:
MailMessage^ Forward(
   String^ from,
   String^ to,
   String^ comment,
   ForwardFormat format
)

Parameters

from
Address used for From.
to
Address used for To.
comment
Text to prepend to the message, added as specified by the format argument.
format
The desired ForwardFormat.

Return Value

A MailMessage

Remarks

The Subject is prepended with "Fwd: ". The original message is not modified.

The returned MailMessage may contain cloned parts, depending on the value of format.

Example

In this example, the Pop component gets only messages with specific subject lines. It then creates and queues "reply" and "forward" response messages for these messages.
C# Copy Code
//Queued response messages ready for sending
List<MailMessage> queuedMessages = new List<MailMessage>();

private void autoReply(object sender)
{
    //Configure server and account info
    pop1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session));
    pop1.Session.Username = myUsername;
    pop1.Session.Password = myPassword;

    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Get header for each message in the account and create response according to subject
    foreach (PopMessage popMessage in pop1.Messages)
    {
        popMessage.Get(0);
        string code = popMessage.Message.Subject;

        //If message contains a specific subject, get entire message then queue an automated response message
        switch (code)
        {
            case "ALERT":
                popMessage.Get();
                //Create a reply message and add it to a list of messages to be sent
                MailMessage replyMessage = popMessage.Message.Reply(fromAddress, "Message acknowledged.");
                queuedMessages.Add(replyMessage);
                break;
            case "ALERT ACK ALL":
                popMessage.Get();
                //Create a reply-all message and add it to a list of messages to be sent
                MailMessage replyAllMessage = popMessage.Message.ReplyAll(fromAddress, "Message acknowledged to all.");
                queuedMessages.Add(replyAllMessage);
                break;
            case "ALERT ELEVATE":
                popMessage.Get();
                //Create a forward message and add it to a list of messages to be sent
                MailMessage forwardMessage = popMessage.Message.Forward(fromAddress, supervisorAddress, "Elevated. Please see message below.", ForwardFormat.Standard);
                queuedMessages.Add(forwardMessage);
                break;
            case "ALERT INFORM":
                popMessage.Get();
                //Create a redirect message and add it to a list of messages to be sent
                MailMessage redirectMessage = popMessage.Message.Forward(fromAddress, colleagueAddress, "Redirected. Please see included message.", ForwardFormat.Redirect);
                queuedMessages.Add(redirectMessage);
                break;
            default:
                break;
        }
    }

    //Gracefully logout
    pop1.Close();

    //Send queued responses (not implemented in this snippet)
    sendResponses();
}

private void sendResponses()
{
    //Configure server and account info
    smtp1.Session.RemoteEndPoint = new IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send all messages in the responses list
    foreach (MailMessage message in queuedMessages)
        smtp1.Send(message);
    queuedMessages.Clear();

    //Gracefully logout
    smtp1.Close();
}
Visual Basic Copy Code
'Queued response messages ready for sending
Private queuedMessages As New List(Of MailMessage)()

Private Sub autoReply(ByVal sender As Object)
    'Configure server and account info
    pop1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session))
    pop1.Session.Username = myUsername
    pop1.Session.Password = myPassword

    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Get header for each message in the account and create response according to subject
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get(0)
        Dim code As String = popMessage.Message.Subject

        'If message contains a specific subject, get entire message then queue an automated response message
        Select Case code
            Case "ALERT"
                popMessage.Get()
                'Create a reply message and add it to a list of messages to be sent
                Dim replyMessage As MailMessage = popMessage.Message.Reply(fromAddress, "Message acknowledged.")
                queuedMessages.Add(replyMessage)
            Case "ALERT ACK ALL"
                popMessage.Get()
                'Create a reply-all message and add it to a list of messages to be sent
                Dim replyAllMessage As MailMessage = popMessage.Message.ReplyAll(fromAddress, "Message acknowledged to all.")
                queuedMessages.Add(replyAllMessage)
            Case "ALERT ELEVATE"
                popMessage.Get()
                'Create a forward message and add it to a list of messages to be sent
                Dim forwardMessage As MailMessage = popMessage.Message.Forward(fromAddress, supervisorAddress, "Elevated. Please see message below.", ForwardFormat.Standard)
                queuedMessages.Add(forwardMessage)
            Case "ALERT INFORM"
                popMessage.Get()
                'Create a redirect message and add it to a list of messages to be sent
                Dim redirectMessage As MailMessage = popMessage.Message.Forward(fromAddress, colleagueAddress, "Redirected. Please see included message.", ForwardFormat.Redirect)
                queuedMessages.Add(redirectMessage)
            Case Else
        End Select
    Next popMessage

    'Gracefully logout
    pop1.Close()

    'Send queued responses (not implemented in this snippet)
    sendResponses()
End Sub

Private Sub sendResponses()
    'Configure server and account info
    smtp1.Session.RemoteEndPoint = New IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send all messages in the responses list
    For Each message As MailMessage In queuedMessages
        smtp1.Send(message)
    Next message
    queuedMessages.Clear()

    'Gracefully logout
    smtp1.Close()
End Sub

See Also

Reference

MailMessage Class
MailMessage Members


GetContentEncodingStream Method

[image]
PowerTCP Mail for .NET
GetContentEncodingStream Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : GetContentEncodingStream Method

Glossary Item Box

Used to encode message content.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetContentEncodingStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As Stream

value = instance.GetContentEncodingStream()
C#
public override Stream GetContentEncodingStream()
Managed Extensions for C++
public: Stream* GetContentEncodingStream(); override
C++/CLI
public:
Stream^ GetContentEncodingStream(); override

Return Value

A Stream that the encoded message can be read from.

Remarks

If IsMime is true, normal MIME encoding is performed.

If IsMime is false, this method returns a Stream that uses UUENCODE for encoding attachments. The first Textpart will be used for the text portion. Included Attachments will be UUENCODED.

See Also

Reference

MailMessage Class
MailMessage Members


GetObjectData Method

[image]
PowerTCP Mail for .NET
GetObjectData Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : GetObjectData Method

info
Serialization information.
context
Streaming context.

Glossary Item Box

This method supports the .NET infrastructure and is not meant to be called directly from your code.

Syntax

Visual Basic (Declaration)
<SecurityCriticalAttribute()>
Public Sub GetObjectData( _
   ByVal info As SerializationInfo, _
   ByVal context As StreamingContext _
)
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim info As SerializationInfo
Dim context As StreamingContext

instance.GetObjectData(info, context)
C#
[SecurityCritical()]
public void GetObjectData(
   SerializationInfo info,
   StreamingContext context
)
Managed Extensions for C++
[SecurityCritical()]
public: void GetObjectData(
   SerializationInfo* info,
   StreamingContext context
)
C++/CLI
[SecurityCritical()]
public:
void GetObjectData(
   SerializationInfo^ info,
   StreamingContext context
)

Parameters

info
Serialization information.
context
Streaming context.

See Also

Reference

MailMessage Class
MailMessage Members


Open Method

[image]
PowerTCP Mail for .NET
Open Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Open Method

Glossary Item Box

Decodes the provided Stream and populates the Part.

Overload List

Overload | Description
Open(Stream) | Decodes the provided Stream and populates the Part.
Open(String) | Decodes the content of the provided file and populates the Part.

See Also

Reference

MailMessage Class
MailMessage Members


Open(Stream) Method

[image]
PowerTCP Mail for .NET
Open(Stream) Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class > Open Method : Open(Stream) Method

encodedStream
The encoded part or mail message.

Glossary Item Box

Decodes the provided Stream and populates the Part.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Open( _
   ByVal encodedStream As Stream _
)
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim encodedStream As Stream

instance.Open(encodedStream)
C#
public void Open(
   Stream encodedStream
)
Managed Extensions for C++
public: void Open(
   Stream* encodedStream
)
C++/CLI
public:
void Open(
   Stream^ encodedStream
)

Parameters

encodedStream
The encoded part or mail message.

Remarks

An encoded message is typically provided by the Pop or Imap control, or it may have been previously saved to storage as a .eml file. This method is placed at the Part level to support the decoding of any message part. The caller is responsible for opening and closing encodedStream.

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


Open(String) Method

[image]
PowerTCP Mail for .NET
Open(String) Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class > Open Method : Open(String) Method

filePath
The encoded part or mail message.

Glossary Item Box

Decodes the content of the provided file and populates the Part.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Open( _
   ByVal filePath As String _
)
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim filePath As String

instance.Open(filePath)
C#
public void Open(
   string filePath
)
Managed Extensions for C++
public: void Open(
   string* filePath
)
C++/CLI
public:
void Open(
   String^ filePath
)

Parameters

filePath
The encoded part or mail message.

Remarks

An encoded message is typically provided by the Pop or Imap control, or it may have been previously saved to storage as a .eml file. This method is placed at the Part level to support the decoding of any message part. The caller is responsible for opening and closing encodedStream.

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


Reply Method

[image]
PowerTCP Mail for .NET
Reply Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Reply Method

from
Address to use for From.
text
Text for the first part of the new message (Part[0]).

Glossary Item Box

Creates a reply message by inserting a new Textpart. Leaves the original parts unmodified.

Syntax

Visual Basic (Declaration)
Public Function Reply( _
   ByVal from As String, _
   ByVal text As String _
) As MailMessage
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim from As String
Dim text As String
Dim value As MailMessage

value = instance.Reply(from, text)
C#
public MailMessage Reply(
   string from,
   string text
)
Managed Extensions for C++
public: MailMessage* Reply(
   string* from,
   string* text
)
C++/CLI
public:
MailMessage^ Reply(
   String^ from,
   String^ text
)

Parameters

from
Address to use for From.
text
Text for the first part of the new message (Part[0]).

Return Value

A MailMessage.

Exceptions

Exception | Description
System.FormatException | Indicates a from or to address is not properly formatted.

Remarks

Useful for situations (such as automation) where the original parts should be left unmodified. For a more UI-centric reply method, use ReplyInline.

The MailMessage is cloned and the 'text' parameter used to initialize a new Textpart which is inserted as Part[0]. The new message is addressed to the "Reply-To" or "From:" header field found in the original message ("Reply-To" supersedes "From:). "Re: " is prepended to the Subject.

This method does not modify the original message. Use ReplyAll to reply to all recipients. Use Forward to forward a message.

The returned message can be modified to change any default values.

Example

In this example, the Pop component gets only messages with specific subject lines. It then creates and queues "reply" and "forward" response messages for these messages.
C# Copy Code
//Queued response messages ready for sending
List<MailMessage> queuedMessages = new List<MailMessage>();

private void autoReply(object sender)
{
    //Configure server and account info
    pop1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session));
    pop1.Session.Username = myUsername;
    pop1.Session.Password = myPassword;

    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Get header for each message in the account and create response according to subject
    foreach (PopMessage popMessage in pop1.Messages)
    {
        popMessage.Get(0);
        string code = popMessage.Message.Subject;

        //If message contains a specific subject, get entire message then queue an automated response message
        switch (code)
        {
            case "ALERT":
                popMessage.Get();
                //Create a reply message and add it to a list of messages to be sent
                MailMessage replyMessage = popMessage.Message.Reply(fromAddress, "Message acknowledged.");
                queuedMessages.Add(replyMessage);
                break;
            case "ALERT ACK ALL":
                popMessage.Get();
                //Create a reply-all message and add it to a list of messages to be sent
                MailMessage replyAllMessage = popMessage.Message.ReplyAll(fromAddress, "Message acknowledged to all.");
                queuedMessages.Add(replyAllMessage);
                break;
            case "ALERT ELEVATE":
                popMessage.Get();
                //Create a forward message and add it to a list of messages to be sent
                MailMessage forwardMessage = popMessage.Message.Forward(fromAddress, supervisorAddress, "Elevated. Please see message below.", ForwardFormat.Standard);
                queuedMessages.Add(forwardMessage);
                break;
            case "ALERT INFORM":
                popMessage.Get();
                //Create a redirect message and add it to a list of messages to be sent
                MailMessage redirectMessage = popMessage.Message.Forward(fromAddress, colleagueAddress, "Redirected. Please see included message.", ForwardFormat.Redirect);
                queuedMessages.Add(redirectMessage);
                break;
            default:
                break;
        }
    }

    //Gracefully logout
    pop1.Close();

    //Send queued responses (not implemented in this snippet)
    sendResponses();
}

private void sendResponses()
{
    //Configure server and account info
    smtp1.Session.RemoteEndPoint = new IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send all messages in the responses list
    foreach (MailMessage message in queuedMessages)
        smtp1.Send(message);
    queuedMessages.Clear();

    //Gracefully logout
    smtp1.Close();
}
Visual Basic Copy Code
'Queued response messages ready for sending
Private queuedMessages As New List(Of MailMessage)()

Private Sub autoReply(ByVal sender As Object)
    'Configure server and account info
    pop1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session))
    pop1.Session.Username = myUsername
    pop1.Session.Password = myPassword

    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Get header for each message in the account and create response according to subject
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get(0)
        Dim code As String = popMessage.Message.Subject

        'If message contains a specific subject, get entire message then queue an automated response message
        Select Case code
            Case "ALERT"
                popMessage.Get()
                'Create a reply message and add it to a list of messages to be sent
                Dim replyMessage As MailMessage = popMessage.Message.Reply(fromAddress, "Message acknowledged.")
                queuedMessages.Add(replyMessage)
            Case "ALERT ACK ALL"
                popMessage.Get()
                'Create a reply-all message and add it to a list of messages to be sent
                Dim replyAllMessage As MailMessage = popMessage.Message.ReplyAll(fromAddress, "Message acknowledged to all.")
                queuedMessages.Add(replyAllMessage)
            Case "ALERT ELEVATE"
                popMessage.Get()
                'Create a forward message and add it to a list of messages to be sent
                Dim forwardMessage As MailMessage = popMessage.Message.Forward(fromAddress, supervisorAddress, "Elevated. Please see message below.", ForwardFormat.Standard)
                queuedMessages.Add(forwardMessage)
            Case "ALERT INFORM"
                popMessage.Get()
                'Create a redirect message and add it to a list of messages to be sent
                Dim redirectMessage As MailMessage = popMessage.Message.Forward(fromAddress, colleagueAddress, "Redirected. Please see included message.", ForwardFormat.Redirect)
                queuedMessages.Add(redirectMessage)
            Case Else
        End Select
    Next popMessage

    'Gracefully logout
    pop1.Close()

    'Send queued responses (not implemented in this snippet)
    sendResponses()
End Sub

Private Sub sendResponses()
    'Configure server and account info
    smtp1.Session.RemoteEndPoint = New IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send all messages in the responses list
    For Each message As MailMessage In queuedMessages
        smtp1.Send(message)
    Next message
    queuedMessages.Clear()

    'Gracefully logout
    smtp1.Close()
End Sub

See Also

Reference

MailMessage Class
MailMessage Members


ReplyAll Method

[image]
PowerTCP Mail for .NET
ReplyAll Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class : ReplyAll Method

from
Address to use for From.
text
Text for the first part of the new message (Part[0]).

Glossary Item Box

Creates a reply message by inserting a new Textpart. Leaves the original parts unmodified. Replies to the sender and CC's all recipients.

Syntax

Visual Basic (Declaration)
Public Function ReplyAll( _
   ByVal from As String, _
   ByVal text As String _
) As MailMessage
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim from As String
Dim text As String
Dim value As MailMessage

value = instance.ReplyAll(from, text)
C#
public MailMessage ReplyAll(
   string from,
   string text
)
Managed Extensions for C++
public: MailMessage* ReplyAll(
   string* from,
   string* text
)
C++/CLI
public:
MailMessage^ ReplyAll(
   String^ from,
   String^ text
)

Parameters

from
Address to use for From.
text
Text for the first part of the new message (Part[0]).

Return Value

A MailMessage.

Exceptions

Exception | Description
System.FormatException | Bad address format.

Remarks

Useful for situations (such as automation) where the original parts should be left unmodified. For a more UI-centric reply method, use ReplyAllInline.

The MailMessage is cloned and the 'text' parameter used to initialize a new Textpart which is inserted as Part[0]. The new message is addressed to the "Reply-To" or "From:" header field found in the original message ("Reply-To" supersedes "From:). All other recipients are added to Cc. "Re: " is prepended to the Subject.

This method does not modify the original message. Use Reply to reply to only the sender. Use Forward to forward the message.

The returned message can be modified to change any default values.

Example

In this example, the Pop component gets only messages with specific subject lines. It then creates and queues "reply" and "forward" response messages for these messages.
C# Copy Code
//Queued response messages ready for sending
List<MailMessage> queuedMessages = new List<MailMessage>();

private void autoReply(object sender)
{
    //Configure server and account info
    pop1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session));
    pop1.Session.Username = myUsername;
    pop1.Session.Password = myPassword;

    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Get header for each message in the account and create response according to subject
    foreach (PopMessage popMessage in pop1.Messages)
    {
        popMessage.Get(0);
        string code = popMessage.Message.Subject;

        //If message contains a specific subject, get entire message then queue an automated response message
        switch (code)
        {
            case "ALERT":
                popMessage.Get();
                //Create a reply message and add it to a list of messages to be sent
                MailMessage replyMessage = popMessage.Message.Reply(fromAddress, "Message acknowledged.");
                queuedMessages.Add(replyMessage);
                break;
            case "ALERT ACK ALL":
                popMessage.Get();
                //Create a reply-all message and add it to a list of messages to be sent
                MailMessage replyAllMessage = popMessage.Message.ReplyAll(fromAddress, "Message acknowledged to all.");
                queuedMessages.Add(replyAllMessage);
                break;
            case "ALERT ELEVATE":
                popMessage.Get();
                //Create a forward message and add it to a list of messages to be sent
                MailMessage forwardMessage = popMessage.Message.Forward(fromAddress, supervisorAddress, "Elevated. Please see message below.", ForwardFormat.Standard);
                queuedMessages.Add(forwardMessage);
                break;
            case "ALERT INFORM":
                popMessage.Get();
                //Create a redirect message and add it to a list of messages to be sent
                MailMessage redirectMessage = popMessage.Message.Forward(fromAddress, colleagueAddress, "Redirected. Please see included message.", ForwardFormat.Redirect);
                queuedMessages.Add(redirectMessage);
                break;
            default:
                break;
        }
    }

    //Gracefully logout
    pop1.Close();

    //Send queued responses (not implemented in this snippet)
    sendResponses();
}

private void sendResponses()
{
    //Configure server and account info
    smtp1.Session.RemoteEndPoint = new IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send all messages in the responses list
    foreach (MailMessage message in queuedMessages)
        smtp1.Send(message);
    queuedMessages.Clear();

    //Gracefully logout
    smtp1.Close();
}
Visual Basic Copy Code
'Queued response messages ready for sending
Private queuedMessages As New List(Of MailMessage)()

Private Sub autoReply(ByVal sender As Object)
    'Configure server and account info
    pop1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session))
    pop1.Session.Username = myUsername
    pop1.Session.Password = myPassword

    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Get header for each message in the account and create response according to subject
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get(0)
        Dim code As String = popMessage.Message.Subject

        'If message contains a specific subject, get entire message then queue an automated response message
        Select Case code
            Case "ALERT"
                popMessage.Get()
                'Create a reply message and add it to a list of messages to be sent
                Dim replyMessage As MailMessage = popMessage.Message.Reply(fromAddress, "Message acknowledged.")
                queuedMessages.Add(replyMessage)
            Case "ALERT ACK ALL"
                popMessage.Get()
                'Create a reply-all message and add it to a list of messages to be sent
                Dim replyAllMessage As MailMessage = popMessage.Message.ReplyAll(fromAddress, "Message acknowledged to all.")
                queuedMessages.Add(replyAllMessage)
            Case "ALERT ELEVATE"
                popMessage.Get()
                'Create a forward message and add it to a list of messages to be sent
                Dim forwardMessage As MailMessage = popMessage.Message.Forward(fromAddress, supervisorAddress, "Elevated. Please see message below.", ForwardFormat.Standard)
                queuedMessages.Add(forwardMessage)
            Case "ALERT INFORM"
                popMessage.Get()
                'Create a redirect message and add it to a list of messages to be sent
                Dim redirectMessage As MailMessage = popMessage.Message.Forward(fromAddress, colleagueAddress, "Redirected. Please see included message.", ForwardFormat.Redirect)
                queuedMessages.Add(redirectMessage)
            Case Else
        End Select
    Next popMessage

    'Gracefully logout
    pop1.Close()

    'Send queued responses (not implemented in this snippet)
    sendResponses()
End Sub

Private Sub sendResponses()
    'Configure server and account info
    smtp1.Session.RemoteEndPoint = New IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send all messages in the responses list
    For Each message As MailMessage In queuedMessages
        smtp1.Send(message)
    Next message
    queuedMessages.Clear()

    'Gracefully logout
    smtp1.Close()
End Sub

See Also

Reference

MailMessage Class
MailMessage Members


ReplyAllInline Method

[image]
PowerTCP Mail for .NET
ReplyAllInline Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class : ReplyAllInline Method

from
Address to use for From.
textReply
Text to prepend to MailMessage.Text.
textSeparator
Text to separate textReply from the original MailMessage.Text.
htmlReply
HTML to prepend to MailMessage.Html.
htmlSeparator
Text/HTML to separate htmlReply from the original MailMessage.Html.

Glossary Item Box

Creates a reply message by prepending the reply text/HTML and separators to the original text/HTML. Replies to the sender and CC's all recipients.

Syntax

Visual Basic (Declaration)
Public Function ReplyAllInline( _
   ByVal from As String, _
   ByVal textReply As String, _
   ByVal textSeparator As String, _
   ByVal htmlReply As String, _
   ByVal htmlSeparator As String _
) As MailMessage
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim from As String
Dim textReply As String
Dim textSeparator As String
Dim htmlReply As String
Dim htmlSeparator As String
Dim value As MailMessage

value = instance.ReplyAllInline(from, textReply, textSeparator, htmlReply, htmlSeparator)
C#
public MailMessage ReplyAllInline(
   string from,
   string textReply,
   string textSeparator,
   string htmlReply,
   string htmlSeparator
)
Managed Extensions for C++
public: MailMessage* ReplyAllInline(
   string* from,
   string* textReply,
   string* textSeparator,
   string* htmlReply,
   string* htmlSeparator
)
C++/CLI
public:
MailMessage^ ReplyAllInline(
   String^ from,
   String^ textReply,
   String^ textSeparator,
   String^ htmlReply,
   String^ htmlSeparator
)

Parameters

from
Address to use for From.
textReply
Text to prepend to MailMessage.Text.
textSeparator
Text to separate textReply from the original MailMessage.Text.
htmlReply
HTML to prepend to MailMessage.Html.
htmlSeparator
Text/HTML to separate htmlReply from the original MailMessage.Html.

Return Value

A MailMessage.

Exceptions

Exception | Description
System.FormatException | Indicates a from or to address is not properly formatted.

Remarks

Can be used to create a UI-centric reply message (use empty strings for textReply and htmlReply). To create a reply that leaves the original parts unmodified, use ReplyAll.

The MailMessage is cloned and the 'textReply' and 'textSeparator' arguments are prepended to MailMessage.Text, separated by System.Environment.NewLine. If the original MailMessage.Html is populated, it is wrapped in a blockquote tag, and the 'htmlReply' and 'htmlSeparator' arguments are prepended to it, separated by line break tags. If the original MailMessage.Html is not populated, it is set to the 'htmlReply' and 'htmlSeparator' arguments, separated by line break tags (if they are specified). The new message is addressed to the "Reply-To" or "From:" header field found in the original message ("Reply-To" supersedes "From:). All other recipients are added to Cc. "Re: " is prepended to the Subject.

This method modifies the original message. Use ReplyInline to reply to only the sender. Use Forward to forward a message.

The returned message can be modified to change any default values.

Example

Demonstrates generating the common reply separator.
C# Copy Code
/// <summary>
/// Generates the common reply separator.
/// </summary>
/// <param name="message">The message that is being replied to.</param>
/// <returns>A reply separator that can be used for the *Separator arguments of MailMessage.ReplyInline() or ReplyAllInline().</returns>
public string GenerateReplySeparator(MailMessage message)
{
    return "On " + message.Date.ToString() + ", " + message.From + " wrote:";
}
Visual Basic Copy Code
''' <summary>
''' Generates the common reply separator.
''' </summary>
''' <param name="message">The message that is being replied to.</param>
''' <returns>A reply separator that can be used for the *Separator arguments of MailMessage.ReplyInline() or ReplyAllInline().</returns>
Public Function GenerateReplySeparator(ByVal message As MailMessage) As String
    Return "On " & message.Date.ToString() & ", " & message.From & " wrote:"
End Function

See Also

Reference

MailMessage Class
MailMessage Members


ReplyInline Method

[image]
PowerTCP Mail for .NET
ReplyInline Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class : ReplyInline Method

from
Address to use for From.
textReply
Text to prepend to MailMessage.Text.
textSeparator
Text to separate textReply from the original MailMessage.Text.
htmlReply
HTML to prepend to MailMessage.Html.
htmlSeparator
Text/HTML to separate htmlReply from the original MailMessage.Html.

Glossary Item Box

Creates a reply message by prepending the reply text/HTML and separators to the original text/HTML.

Syntax

Visual Basic (Declaration)
Public Function ReplyInline( _
   ByVal from As String, _
   ByVal textReply As String, _
   ByVal textSeparator As String, _
   ByVal htmlReply As String, _
   ByVal htmlSeparator As String _
) As MailMessage
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim from As String
Dim textReply As String
Dim textSeparator As String
Dim htmlReply As String
Dim htmlSeparator As String
Dim value As MailMessage

value = instance.ReplyInline(from, textReply, textSeparator, htmlReply, htmlSeparator)
C#
public MailMessage ReplyInline(
   string from,
   string textReply,
   string textSeparator,
   string htmlReply,
   string htmlSeparator
)
Managed Extensions for C++
public: MailMessage* ReplyInline(
   string* from,
   string* textReply,
   string* textSeparator,
   string* htmlReply,
   string* htmlSeparator
)
C++/CLI
public:
MailMessage^ ReplyInline(
   String^ from,
   String^ textReply,
   String^ textSeparator,
   String^ htmlReply,
   String^ htmlSeparator
)

Parameters

from
Address to use for From.
textReply
Text to prepend to MailMessage.Text.
textSeparator
Text to separate textReply from the original MailMessage.Text.
htmlReply
HTML to prepend to MailMessage.Html.
htmlSeparator
Text/HTML to separate htmlReply from the original MailMessage.Html.

Return Value

A MailMessage.

Exceptions

Exception | Description
System.FormatException | Indicates a from or to address is not properly formatted.

Remarks

Can be used to create a UI-centric reply message (use empty strings for textReply and htmlReply). To create a reply that leaves the original parts unmodified, use Reply.

The MailMessage is cloned and the 'textReply' and 'textSeparator' arguments are prepended to MailMessage.Text, separated by System.Environment.NewLine. If the original MailMessage.Html is populated, it is wrapped in a blockquote tag, and the 'htmlReply' and 'htmlSeparator' arguments are prepended to it, separated by line break tags. If the original MailMessage.Html is not populated, it is set to the 'htmlReply' and 'htmlSeparator' arguments, separated by line break tags (if they are specified). The new message is addressed to the "Reply-To" or "From:" header field found in the original message ("Reply-To" supersedes "From:). "Re: " is prepended to the Subject.

This method modifies the original message. Use ReplyAllInline to reply to all recipients. Use Forward to forward a message.

The returned message can be modified to change any default values.

Example

Demonstrates generating the common reply separator.
C# Copy Code
/// <summary>
/// Generates the common reply separator.
/// </summary>
/// <param name="message">The message that is being replied to.</param>
/// <returns>A reply separator that can be used for the *Separator arguments of MailMessage.ReplyInline() or ReplyAllInline().</returns>
public string GenerateReplySeparator(MailMessage message)
{
    return "On " + message.Date.ToString() + ", " + message.From + " wrote:";
}
Visual Basic Copy Code
''' <summary>
''' Generates the common reply separator.
''' </summary>
''' <param name="message">The message that is being replied to.</param>
''' <returns>A reply separator that can be used for the *Separator arguments of MailMessage.ReplyInline() or ReplyAllInline().</returns>
Public Function GenerateReplySeparator(ByVal message As MailMessage) As String
    Return "On " & message.Date.ToString() & ", " & message.From & " wrote:"
End Function

See Also

Reference

MailMessage Class
MailMessage Members


Save Method

[image]
PowerTCP Mail for .NET
Save Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Save Method

Glossary Item Box

Encodes the MIME entity and saves it to the specified stream.

Overload List

Overload | Description
Save(Stream) | Encodes the MIME entity and saves it to the specified stream.
Save(String) | Encodes the MailMessage and saves it to the specified location.

See Also

Reference

MailMessage Class
MailMessage Members


Save(Stream) Method

[image]
PowerTCP Mail for .NET
Save(Stream) Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class > Save Method : Save(Stream) Method

encodedStream
The System.IO.Stream that the message will be written to.

Glossary Item Box

Encodes the MIME entity and saves it to the specified stream.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Save( _
   ByVal encodedStream As Stream _
)
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim encodedStream As Stream

instance.Save(encodedStream)
C#
public void Save(
   Stream encodedStream
)
Managed Extensions for C++
public: void Save(
   Stream* encodedStream
)
C++/CLI
public:
void Save(
   Stream^ encodedStream
)

Parameters

encodedStream
The System.IO.Stream that the message will be written to.

Exceptions

Exception | Description
System.UnauthorizedAccessException | This usually indicates that an antivirus has quarantined or blocked access to a decoded attachment on disk. Set DecodeToMemory to true to decode attachments to memory instead of to disk to circumvent your antivirus. Alternatively, test each attachment with Attachment.Content.OpenRead() and remove any attachments that throw an exception.
System.IO.FileNotFoundException | This usually indicates that an antivirus has quarantined or blocked access to a decoded attachment on disk. Set DecodeToMemory to true to decode attachments to memory instead of to disk to circumvent your antivirus. Alternatively, test each attachment with Attachment.Content.OpenRead() and remove any attachments that throw an exception.

Remarks

The caller is responsible for opening and closing encodedStream.

Saving a MailMessage with this method will include the Bcc field, which should not be included in messages sent to a server. To output the MailMessage as it would be sent to a server, use MailMessage.GetEncodingStream().

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


Save(String) Method

[image]
PowerTCP Mail for .NET
Save(String) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class > Save Method : Save(String) Method

filePath
The file location where the encoded message will be saved.

Glossary Item Box

Encodes the MailMessage and saves it to the specified location.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Save( _
   ByVal filePath As String _
)
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim filePath As String

instance.Save(filePath)
C#
public void Save(
   string filePath
)
Managed Extensions for C++
public: void Save(
   string* filePath
)
C++/CLI
public:
void Save(
   String^ filePath
)

Parameters

filePath
The file location where the encoded message will be saved.

Exceptions

Exception | Description
System.UnauthorizedAccessException | This often indicates that an antivirus has quarantined or blocked access to a decoded attachment on disk. Set DecodeToMemory to true to decode attachments to memory instead of to disk to circumvent your antivirus. Alternatively, test each attachment with Attachment.Content.OpenRead() and remove any attachments that throw an exception.
System.IO.FileNotFoundException | This often indicates that an antivirus has quarantined or blocked access to a decoded attachment on disk. Set DecodeToMemory to true to decode attachments to memory instead of to disk to circumvent your antivirus. Alternatively, test each attachment with Attachment.Content.OpenRead() and remove any attachments that throw an exception.

Remarks

Any existing file will be overwritten.

Saving a MailMessage with this method will include the Bcc field, which should not be included in messages sent to a server. To output the MailMessage as it would be sent to a server, use MailMessage.GetEncodingStream().

Example

In this example, messages are retrieved with the Pop component then saved to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Download all messages in the account and save them to disk with a unique name
    string messageFolder = Application.StartupPath + "\\messages";
    foreach (PopMessage popMessage in pop1.Messages)
    {
        popMessage.Get();
        popMessage.Message.Save(messageFolder + "\\" + popMessage.Id.ToString("D4") + ".eml");
    }

    //Gracefully logout of the session
    pop1.Close();
}

private void pop1_Progress(object sender, PopProgressEventArgs e)
{
    //Update progress bar as messages are received
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Download all messages in the account and save them to disk with a unique name
    Dim messageFolder As String = Application.StartupPath & "\messages"
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get()
        popMessage.Message.Save(messageFolder & "\" & popMessage.Id.ToString("D4") & ".eml")
    Next popMessage

    'Gracefully logout of the session
    pop1.Close()
End Sub

Private Sub pop1_Progress(ByVal sender As Object, ByVal e As PopProgressEventArgs) Handles pop1.Progress
    'Update progress bar as messages are received
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


SecureDecode Method

[image]
PowerTCP Mail for .NET
SecureDecode Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : SecureDecode Method

Glossary Item Box

Decode the S/MIME encoded MailMessage.

Overload List

Overload | Description
SecureDecode(X509Certificate2Collection,Boolean) | Decode the S/MIME encoded MailMessage.
SecureDecode() | Decode the S/MIME encoded MailMessage using default values.

See Also

Reference

MailMessage Class
MailMessage Members


SecureDecode(X509Certificate2Collection,Boolean) Method

[image]
PowerTCP Mail for .NET
SecureDecode(X509Certificate2Collection,Boolean) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class > SecureDecode Method : SecureDecode(X509Certificate2Collection,Boolean) Method

decryptingCertificates
If the message is encrypted, these certificates and those in the "MY" certificate store are searched for the certificate needed for decryption.
importSigningCertificate
If true, the signing certificate is added to the user's "AddressBook" certificate store.

Glossary Item Box

Decode the S/MIME encoded MailMessage.

Syntax

Visual Basic (Declaration)
Public Overloads Function SecureDecode( _
   ByVal decryptingCertificates As X509Certificate2Collection, _
   ByVal importSigningCertificate As Boolean _
) As SignerInfoCollection
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim decryptingCertificates As X509Certificate2Collection
Dim importSigningCertificate As Boolean
Dim value As SignerInfoCollection

value = instance.SecureDecode(decryptingCertificates, importSigningCertificate)
C#
public SignerInfoCollection SecureDecode(
   X509Certificate2Collection decryptingCertificates,
   bool importSigningCertificate
)
Managed Extensions for C++
public: SignerInfoCollection* SecureDecode(
   X509Certificate2Collection* decryptingCertificates,
   bool importSigningCertificate
)
C++/CLI
public:
SignerInfoCollection^ SecureDecode(
   X509Certificate2Collection^ decryptingCertificates,
   bool importSigningCertificate
)

Parameters

decryptingCertificates
If the message is encrypted, these certificates and those in the "MY" certificate store are searched for the certificate needed for decryption.
importSigningCertificate
If true, the signing certificate is added to the user's "AddressBook" certificate store.

Return Value

System.Security.Cryptography.Pkcs.SignerInfoCollection containing the signing certificate and additional information found in any signed message.

Exceptions

Exception | Description
System.FormatException | Format not recognized.
System.Security.Cryptography.CryptographicException | A cryptographic operation could not be completed. Thrown if the signer could not be validated.

Remarks

If IsSecure is true, this method verifies and/or decrypts the S/MIME message in place. If successful, IsSecure returns false. If unsuccessful, an Exception is thrown; decryption may succeed before signer verification throws an exception, so the message may be partially decoded if an exception is thrown.

Specify decryptingCertificates to supplement the certificates in the user's "MY" certificate store. If the user's certificate store contains a valid certificate, use null.

If importSigningCertificates is true, the signing certificate is added to the "AddressBook" certificate store. The user can then use SecureEncrypt on future messages sent to this sender without specifying an encrypting certificate because SecureEncrypt will check the "AddressBook" certificate store for a matching certificate.

To verify the digital signature or validate the certificate, call SignerInfo.CheckSignature(Boolean) on each member of the returned System.Security.Cryptography.Pkcs.SignerInfoCollection.

Example

This example demonstrates decoding an SMIME message that was either signed, encrypted or both.
C# Copy Code
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.Pkcs;

private MailMessage getDecodedMessage(MailMessage message)
{
    //Load the decrypting certificate from an exported certificate file (may also be loaded from an X509Store)
    X509Certificate2 decryptingCertificate = new X509Certificate2(Application.StartupPath + "\\myCertificate.pfx");
    //Decode the message and import the signing certificate into the AddressBook certificate Store
    //(If the decrypting certificate is already present in the "MY" certificate store,
    //the parameterless SecureDecode() may be used instead.)
    SignerInfoCollection signatories = message.SecureDecode(new X509Certificate2Collection(decryptingCertificate), true);
    //Optionally verify the signature and validate the certificate
    foreach (SignerInfo signator in signatories)
        signator.CheckSignature(false);
    return message;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Cryptography.Pkcs

Private Function getDecodedMessage(ByVal message As MailMessage) As MailMessage
    'Load the decrypting certificate from an exported certificate file (may also be loaded from an X509Store)
    Dim decryptingCertificate As New X509Certificate2(Application.StartupPath & "\myCertificate.pfx")
    'Decode the message and import the signing certificate into the AddressBook certificate Store
    '(If the decrypting certificate is already present in the "MY" certificate store,
    'the parameterless SecureDecode() may be used instead.)
    Dim signatories As SignerInfoCollection = message.SecureDecode(New X509Certificate2Collection(decryptingCertificate), True)
    'Optionally verify the signature and validate the certificate
    For Each signator As SignerInfo In signatories
        signator.CheckSignature(False)
    Next signator
    Return message
End Function

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


SecureDecode() Method

[image]
PowerTCP Mail for .NET
SecureDecode() Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class > SecureDecode Method : SecureDecode() Method

Glossary Item Box

Decode the S/MIME encoded MailMessage using default values.

Syntax

Visual Basic (Declaration)
Public Overloads Function SecureDecode() As SignerInfoCollection
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As SignerInfoCollection

value = instance.SecureDecode()
C#
public SignerInfoCollection SecureDecode()
Managed Extensions for C++
public: SignerInfoCollection* SecureDecode();
C++/CLI
public:
SignerInfoCollection^ SecureDecode();

Return Value

System.Security.Cryptography.Pkcs.SignerInfoCollection containing the signing certificate and additional information found in the signed message.

Remarks

If IsSecure is true, this method verifies and/or decrypts the S/MIME message in place. If successful, IsSecure returns false. If unsuccessful, an Exception is thrown; decryption may succeed before signer verification throws an exception, so the message may be partially decoded if an exception is thrown.

This method will search the "MY" certificate store for a valid decrypting certificate as necessary, and imports the message's signing certificates into the "AddressBook" certificate store where they may subsequently be used by SecureEncrypt

To verify the digital signature or validate the certificate, call SignerInfo.CheckSignature(Boolean) on each member of the returned System.Security.Cryptography.Pkcs.SignerInfoCollection.

Use SecureDecode(X509Certificate2Collection,Boolean) if additional control is desired.

Example

This example demonstrates decoding an SMIME message that was either signed, encrypted or both.
C# Copy Code
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.Pkcs;

private MailMessage getDecodedMessage(MailMessage message)
{
    //Load the decrypting certificate from an exported certificate file (may also be loaded from an X509Store)
    X509Certificate2 decryptingCertificate = new X509Certificate2(Application.StartupPath + "\\myCertificate.pfx");
    //Decode the message and import the signing certificate into the AddressBook certificate Store
    //(If the decrypting certificate is already present in the "MY" certificate store,
    //the parameterless SecureDecode() may be used instead.)
    SignerInfoCollection signatories = message.SecureDecode(new X509Certificate2Collection(decryptingCertificate), true);
    //Optionally verify the signature and validate the certificate
    foreach (SignerInfo signator in signatories)
        signator.CheckSignature(false);
    return message;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Cryptography.Pkcs

Private Function getDecodedMessage(ByVal message As MailMessage) As MailMessage
    'Load the decrypting certificate from an exported certificate file (may also be loaded from an X509Store)
    Dim decryptingCertificate As New X509Certificate2(Application.StartupPath & "\myCertificate.pfx")
    'Decode the message and import the signing certificate into the AddressBook certificate Store
    '(If the decrypting certificate is already present in the "MY" certificate store,
    'the parameterless SecureDecode() may be used instead.)
    Dim signatories As SignerInfoCollection = message.SecureDecode(New X509Certificate2Collection(decryptingCertificate), True)
    'Optionally verify the signature and validate the certificate
    For Each signator As SignerInfo In signatories
        signator.CheckSignature(False)
    Next signator
    Return message
End Function

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


SecureEncrypt Method

[image]
PowerTCP Mail for .NET
SecureEncrypt Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : SecureEncrypt Method

Glossary Item Box

Encrypt the MailMessage using S/MIME encoding.

Overload List

Overload | Description
SecureEncrypt(X509Certificate2Collection,EncryptingAlgorithm,Boolean) | Encrypt the MailMessage using S/MIME encoding.
SecureEncrypt() | Encrypt the MailMessage using S/MIME encoding default values.

See Also

Reference

MailMessage Class
MailMessage Members


SecureEncrypt(X509Certificate2Collection,EncryptingAlgorithm,Boolean) Method

[image]
PowerTCP Mail for .NET
SecureEncrypt(X509Certificate2Collection,EncryptingAlgorithm,Boolean) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class > SecureEncrypt Method : SecureEncrypt(X509Certificate2Collection,EncryptingAlgorithm,Boolean) Method

encryptingCertificates
In/Out. Optional System.Security.Cryptography.X509Certificates.X509Certificate2Collection used to override use of certificates from the user's "AddressBook" certificate store. If empty, populated with the certificates used. Can be null.
encryptingAlgorithm
The encryption algorithm to use.
includeHeaders
If true, message header fields are moved into the encrypted payload.

Glossary Item Box

Encrypt the MailMessage using S/MIME encoding.

Syntax

Visual Basic (Declaration)
Public Overloads Sub SecureEncrypt( _
   ByVal encryptingCertificates As X509Certificate2Collection, _
   ByVal encryptingAlgorithm As EncryptingAlgorithm, _
   ByVal includeHeaders As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim encryptingCertificates As X509Certificate2Collection
Dim encryptingAlgorithm As EncryptingAlgorithm
Dim includeHeaders As Boolean

instance.SecureEncrypt(encryptingCertificates, encryptingAlgorithm, includeHeaders)
C#
public void SecureEncrypt(
   X509Certificate2Collection encryptingCertificates,
   EncryptingAlgorithm encryptingAlgorithm,
   bool includeHeaders
)
Managed Extensions for C++
public: void SecureEncrypt(
   X509Certificate2Collection* encryptingCertificates,
   EncryptingAlgorithm encryptingAlgorithm,
   bool includeHeaders
)
C++/CLI
public:
void SecureEncrypt(
   X509Certificate2Collection^ encryptingCertificates,
   EncryptingAlgorithm encryptingAlgorithm,
   bool includeHeaders
)

Parameters

encryptingCertificates
In/Out. Optional System.Security.Cryptography.X509Certificates.X509Certificate2Collection used to override use of certificates from the user's "AddressBook" certificate store. If empty, populated with the certificates used. Can be null.
encryptingAlgorithm
The encryption algorithm to use.
includeHeaders
If true, message header fields are moved into the encrypted payload.

Exceptions

Exception | Description
System.InvalidOperationException | Certificates matching all recipients not found.

Remarks

The MailMessage is encrypted using the public keys of certificates associated with each recipient (To, Cc and Bcc. If encryptingCertificates is empty, it is populated with the certificates used to encrypt the MailMessage (certificates that correspond to each recipient, retrieved from the current user's "AddressBook" certificate store). Encryption is performed for each recipient, so the resulting encrypted MailMessage increases in size as the number of recipients increases.

If includeHeaders is false, the content is encrypted and the message headers are unchanged except for ContentType. If true, the entire message is encrypted and will be restored by the reader during decryption (this was introduced in S/MIME version 3.1 and is not backwards compatible). In this case, sensitive header fields like Subject:, To:, From: and CC: may be removed by the user after encrypting. If the To:, From:, CC:, or BCC: header fields are removed, Smtp.Send or Send(Stream,String,String) must be used.

If successful, the MailMessage is modified and IsSecure returns true. If unsuccessful, the MailMessage is unmodified and an Exception is thrown.

Example

This example demonstrates encrypting a message using the recipient's certificate.
C# Copy Code
using System.Security.Cryptography.X509Certificates;

private MailMessage getEncryptedMessage(MailMessage message)
{
    //Find the encrypting certificate in the CurrentUser/AddressBook store
    //The following code results in the same encrypted message as "message.SecureEncrypt();"
    X509Certificate2Collection encryptingCertificates = new X509Certificate2Collection();
    X509Store addressBookStore = new X509Store(StoreName.AddressBook, StoreLocation.CurrentUser);
    addressBookStore.Open(OpenFlags.ReadOnly);
    foreach (X509Certificate2 certificate in addressBookStore.Certificates)
    {
        if (certificate.Subject.Contains("E=" + message.To))
        {
            encryptingCertificates.Add(certificate);
            //Encrypt the message
            message.SecureEncrypt(encryptingCertificates, EncryptingAlgorithm.TripleDes, false);
            return message;
        }
    }
    return null;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates

Private Function getEncryptedMessage(ByVal message As MailMessage) As MailMessage
    'Find the encrypting certificate in the CurrentUser/AddressBook store
    'The following code results in the same encrypted message as "message.SecureEncrypt();"
    Dim encryptingCertificates As New X509Certificate2Collection()
    Dim addressBookStore As New X509Store(StoreName.AddressBook, StoreLocation.CurrentUser)
    addressBookStore.Open(OpenFlags.ReadOnly)
    For Each certificate As X509Certificate2 In addressBookStore.Certificates
        If certificate.Subject.Contains("E=" & message.To) Then
            encryptingCertificates.Add(certificate)
            'Encrypt the message
            message.SecureEncrypt(encryptingCertificates, EncryptingAlgorithm.TripleDes, False)
            Return message
        End If
    Next certificate
    Return Nothing
End Function

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


SecureEncrypt() Method

[image]
PowerTCP Mail for .NET
SecureEncrypt() Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class > SecureEncrypt Method : SecureEncrypt() Method

Glossary Item Box

Encrypt the MailMessage using S/MIME encoding default values.

Syntax

Visual Basic (Declaration)
Public Overloads Sub SecureEncrypt()
Visual Basic (Usage) Copy Code
Dim instance As MailMessage

instance.SecureEncrypt()
C#
public void SecureEncrypt()
Managed Extensions for C++
public: void SecureEncrypt();
C++/CLI
public:
void SecureEncrypt();

Remarks

The MailMessage is encrypted using EncryptingAlgorithm.TripleDes and the public keys of certificates associated with each recipient (To, Cc and Bcc). These certificates are populated from the "AddressBook" certificate store of the current user. Encryption is performed for each recipient, so the resulting encrypted MailMessage increases in size as the number of recipients increases. Headers are not encrypted.

Use SecureEncrypt(X509Certificate2Collection,EncryptingAlgorithm,Boolean) if additional control is desired.

Example

This example demonstrates encrypting a message using the recipient's certificate.
C# Copy Code
using System.Security.Cryptography.X509Certificates;

private MailMessage getEncryptedMessage(MailMessage message)
{
    //Find the encrypting certificate in the CurrentUser/AddressBook store
    //The following code results in the same encrypted message as "message.SecureEncrypt();"
    X509Certificate2Collection encryptingCertificates = new X509Certificate2Collection();
    X509Store addressBookStore = new X509Store(StoreName.AddressBook, StoreLocation.CurrentUser);
    addressBookStore.Open(OpenFlags.ReadOnly);
    foreach (X509Certificate2 certificate in addressBookStore.Certificates)
    {
        if (certificate.Subject.Contains("E=" + message.To))
        {
            encryptingCertificates.Add(certificate);
            //Encrypt the message
            message.SecureEncrypt(encryptingCertificates, EncryptingAlgorithm.TripleDes, false);
            return message;
        }
    }
    return null;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates

Private Function getEncryptedMessage(ByVal message As MailMessage) As MailMessage
    'Find the encrypting certificate in the CurrentUser/AddressBook store
    'The following code results in the same encrypted message as "message.SecureEncrypt();"
    Dim encryptingCertificates As New X509Certificate2Collection()
    Dim addressBookStore As New X509Store(StoreName.AddressBook, StoreLocation.CurrentUser)
    addressBookStore.Open(OpenFlags.ReadOnly)
    For Each certificate As X509Certificate2 In addressBookStore.Certificates
        If certificate.Subject.Contains("E=" & message.To) Then
            encryptingCertificates.Add(certificate)
            'Encrypt the message
            message.SecureEncrypt(encryptingCertificates, EncryptingAlgorithm.TripleDes, False)
            Return message
        End If
    Next certificate
    Return Nothing
End Function

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


SecureSign Method

[image]
PowerTCP Mail for .NET
SecureSign Method
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : SecureSign Method

Glossary Item Box

Sign the MailMessage using S/MIME encoding.

Overload List

Overload | Description
SecureSign(X509Certificate2,X509IncludeOption,DigestAlgorithm,Boolean,Boolean) | Sign the MailMessage using S/MIME encoding.
SecureSign() | Sign the MailMessage using S/MIME encoding default values.

See Also

Reference

MailMessage Class
MailMessage Members


SecureSign(X509Certificate2,X509IncludeOption,DigestAlgorithm,Boolean,Boolean) Method

[image]
PowerTCP Mail for .NET
SecureSign(X509Certificate2,X509IncludeOption,DigestAlgorithm,Boolean,Boolean) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class > SecureSign Method : SecureSign(X509Certificate2,X509IncludeOption,DigestAlgorithm,Boolean,Boolean) Method

signingCertificate
Certificate to use to sign the MailMessage. If null, From is used to get a certificate from the "MY" certificate store.
includeOption
Specifies what certificates in the certificate chain should be included.
digestAlgorithm
DigestAlgorithm to use to verify the message has not been changed.
detached
If true, creates a "multipart/signed" message using a detached digital signature; otherwise an "application/pkcs7-mime" message is created using signed-data.
includeHeaders
If true and detached is false, message header fields are protected by moving them into the signed payload.

Glossary Item Box

Sign the MailMessage using S/MIME encoding.

Syntax

Visual Basic (Declaration)
Public Overloads Function SecureSign( _
   ByVal signingCertificate As X509Certificate2, _
   ByVal includeOption As X509IncludeOption, _
   ByVal digestAlgorithm As DigestAlgorithm, _
   ByVal detached As Boolean, _
   ByVal includeHeaders As Boolean _
) As X509Certificate2Collection
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim signingCertificate As X509Certificate2
Dim includeOption As X509IncludeOption
Dim digestAlgorithm As DigestAlgorithm
Dim detached As Boolean
Dim includeHeaders As Boolean
Dim value As X509Certificate2Collection

value = instance.SecureSign(signingCertificate, includeOption, digestAlgorithm, detached, includeHeaders)
C#
public X509Certificate2Collection SecureSign(
   X509Certificate2 signingCertificate,
   X509IncludeOption includeOption,
   DigestAlgorithm digestAlgorithm,
   bool detached,
   bool includeHeaders
)
Managed Extensions for C++
public: X509Certificate2Collection* SecureSign(
   X509Certificate2* signingCertificate,
   X509IncludeOption includeOption,
   DigestAlgorithm digestAlgorithm,
   bool detached,
   bool includeHeaders
)
C++/CLI
public:
X509Certificate2Collection^ SecureSign(
   X509Certificate2^ signingCertificate,
   X509IncludeOption includeOption,
   DigestAlgorithm digestAlgorithm,
   bool detached,
   bool includeHeaders
)

Parameters

signingCertificate
Certificate to use to sign the MailMessage. If null, From is used to get a certificate from the "MY" certificate store.
includeOption
Specifies what certificates in the certificate chain should be included.
digestAlgorithm
DigestAlgorithm to use to verify the message has not been changed.
detached
If true, creates a "multipart/signed" message using a detached digital signature; otherwise an "application/pkcs7-mime" message is created using signed-data.
includeHeaders
If true and detached is false, message header fields are protected by moving them into the signed payload.

Return Value

System.Security.Cryptography.X509Certificates.X509Certificate2Collection containing the certificates included within the signed message.

Exceptions

Exception | Description
System.InvalidOperationException | Signing certificate matching From address not found.

Remarks

Recipients of a signed message will typically add the signing certificate to its "AddressBook" certificate store so it can be subsequently used to perform S/MIME encryption on messages sent to that address. Signing certificates contain the public key necessary for encryption.

If detached is true, then the message contents are provided in the clear as the first part (Parts[0]), and the digital signature is provided as the second part (Parts[1] of type Attachment). In a multipart message, a multipart MIME entity is used to aggregate the parts as Parts[0] (this occurs automatically). Most non-S/MIME readers will therefore be able to display the content, while S/MIME readers will be able to use the digital signature to check for message tampering. If detached is false, then the message contents is combined with the digital signature into a single part (Parts[0]) which cannot be displayed by non-S/MIME readers. Typically, if only signing is used then detached signing is preferred for compatibility. If standard signing AND encryption is desired, then first use this method with detached false and then use SecureEncrypt.

If includeHeaders is false, the content is encrypted and the message headers are unchanged except for ContentType. If true, the entire message is encrypted and will be restored by the reader during decryption (this was introduced in version 3.1 and is not backwards compatible). In this case, sensitive header fields like Subject:, To:, From: and CC: may be removed after signing. Note, however, that mail addresses MUST be included in Smtp.Send() if they are removed them from the message.

Complies with S/MIME version 3.2 RFCs (5751, 5652, 5035 and 2634) that are generally backwards compatible with version 2, 3,0 and 3.1.

Example

This example demonstrates signing a message with the sender's digitial signature.
C# Copy Code
using System.Security.Cryptography.X509Certificates;

private MailMessage getSignedMessage(MailMessage message)
{
    //Find the signing certificate in the "CurrentUser/My" certificate store
    //The following code results in the same signed message as "message.SecureSign();"
    X509Store myPersonalStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
    myPersonalStore.Open(OpenFlags.ReadOnly);
    foreach (X509Certificate2 certificate in myPersonalStore.Certificates)
    {
        if (certificate.Subject.Contains("E=" + message.From.ToString()))
        {
            //Sign the message
            message.SecureSign(certificate, X509IncludeOption.ExcludeRoot, DigestAlgorithm.Sha1, true, false);
            return message;
        }
    }
    return null;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates

Private Function getSignedMessage(ByVal message As MailMessage) As MailMessage
    'Find the signing certificate in the "CurrentUser/My" certificate store
    'The following code results in the same signed message as "message.SecureSign();"
    Dim myPersonalStore As New X509Store(StoreName.My, StoreLocation.CurrentUser)
    myPersonalStore.Open(OpenFlags.ReadOnly)
    For Each certificate As X509Certificate2 In myPersonalStore.Certificates
        If certificate.Subject.Contains("E=" & message.From.ToString()) Then
            'Sign the message
            message.SecureSign(certificate, X509IncludeOption.ExcludeRoot, DigestAlgorithm.Sha1, True, False)
            Return message
        End If
    Next certificate
    Return Nothing
End Function

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


SecureSign() Method

[image]
PowerTCP Mail for .NET
SecureSign() Method
See Also Example Send comments on this topic
Dart.Mail Namespace > MailMessage Class > SecureSign Method : SecureSign() Method

Glossary Item Box

Sign the MailMessage using S/MIME encoding default values.

Syntax

Visual Basic (Declaration)
Public Overloads Function SecureSign() As X509Certificate2Collection
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As X509Certificate2Collection

value = instance.SecureSign()
C#
public X509Certificate2Collection SecureSign()
Managed Extensions for C++
public: X509Certificate2Collection* SecureSign();
C++/CLI
public:
X509Certificate2Collection^ SecureSign();

Return Value

System.Security.Cryptography.X509Certificates.X509Certificate2Collection containing the certificates included within the signed message.

Remarks

From is used to locate a signing certificate in the "MY" certificate store and X509IncludeOption.ExcludeRoot used. DigestAlgorithm.Sha256 is used for creating the message hash. A "detached" digital signature is created and included as an attachment.

Use SecureSign(X509Certificate2,X509IncludeOption,DigestAlgorithm,Boolean,Boolean) if additional control is desired.

Example

This example demonstrates signing a message with the sender's digitial signature.
C# Copy Code
using System.Security.Cryptography.X509Certificates;

private MailMessage getSignedMessage(MailMessage message)
{
    //Find the signing certificate in the "CurrentUser/My" certificate store
    //The following code results in the same signed message as "message.SecureSign();"
    X509Store myPersonalStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
    myPersonalStore.Open(OpenFlags.ReadOnly);
    foreach (X509Certificate2 certificate in myPersonalStore.Certificates)
    {
        if (certificate.Subject.Contains("E=" + message.From.ToString()))
        {
            //Sign the message
            message.SecureSign(certificate, X509IncludeOption.ExcludeRoot, DigestAlgorithm.Sha1, true, false);
            return message;
        }
    }
    return null;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates

Private Function getSignedMessage(ByVal message As MailMessage) As MailMessage
    'Find the signing certificate in the "CurrentUser/My" certificate store
    'The following code results in the same signed message as "message.SecureSign();"
    Dim myPersonalStore As New X509Store(StoreName.My, StoreLocation.CurrentUser)
    myPersonalStore.Open(OpenFlags.ReadOnly)
    For Each certificate As X509Certificate2 In myPersonalStore.Certificates
        If certificate.Subject.Contains("E=" & message.From.ToString()) Then
            'Sign the message
            message.SecureSign(certificate, X509IncludeOption.ExcludeRoot, DigestAlgorithm.Sha1, True, False)
            Return message
        End If
    Next certificate
    Return Nothing
End Function

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


MailMessage Class Properties

[image]
PowerTCP Mail for .NET
MailMessage Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : MailMessage Class

Glossary Item Box

For a list of all members of this type, see MailMessage members.

Public Properties

 | Name | Description
Public Property | Attachments | Get a generic List containing all the Attachments within this part and sub-parts. (Inherited from Dart.Mail.Multipart)
Public Property | Bcc | Gets or sets the email address(es) of the "blind carbon-copy" recipient(s).
Public Property | BitEncoding | Gets the bit encoding of the message (SevenBit, EightBit, or Binary only).
Public Property | Cc | Gets or sets the email address(es) of the "carbon-copy" recipient(s).
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Date | Gets and sets the "Date:" header field.
Public Property | From | Gets or sets the email address of who the email is from.
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Html | Gets or sets the HTML text body. (Inherited from Dart.Mail.Multipart)
Public Property | IsMime | Gets or sets a value that controls the use of MIME encoding.
Public Property | IsSecure | Returns false if SecureEncoding is SecureEncoding.None, otherwise true.
Public Property | Length | Returns the approximate Length of the encoded part. (Inherited from Dart.Mail.Multipart)
Public Property | Parts | A Part list that contains all the parts in the Multipart. (Inherited from Dart.Mail.Multipart)
Public Property | Priority | Gets or sets the Priority of the message.
Public Property | ReplyTo | Gets or sets the email address(es) of where any reply should be sent.
Public Property | Resources | Get a generic List containing all the Resources within this part and sub-parts. (Inherited from Dart.Mail.Multipart)
Public Property | SecureEncoding | Indicates the type of S/MIME encoding exposed by the header. Any "inner" encoding is unknown.
Public Property | Sender | Gets or sets the email address of the sender of the email.
Public Property | Subject | Gets or sets the value of the "Subject" header field.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | Text | Gets or sets the plain text body. (Inherited from Dart.Mail.Multipart)
Public Property | To | Gets or sets the email address(es) of the primary recipient(s).
Top

See Also

Reference

MailMessage Class
Dart.Mail Namespace


Bcc Property

[image]
PowerTCP Mail for .NET
Bcc Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Bcc Property

Glossary Item Box

Gets or sets the email address(es) of the "blind carbon-copy" recipient(s).

Syntax

Visual Basic (Declaration)
Public Property Bcc As String
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As String

instance.Bcc = value

value = instance.Bcc
C#
public string Bcc {get; set;}
Managed Extensions for C++
public: __property string* get_Bcc();
public: __property void set_Bcc(
   string* value
);
C++/CLI
public:
property String^ Bcc {
   String^ get();
   void set (    String^ value);
}

Property Value

Decoded email address(es). A comma is used to separate multiple addresses.

Remarks

These addresses are used by Smtp to create the list of recipients. The value is not included in the encoded message.

When set, the address format is standardized and the "friendly name" is word-encoded using HeaderDictionary.Encoding.

See Also

Reference

MailMessage Class
MailMessage Members


BitEncoding Property

[image]
PowerTCP Mail for .NET
BitEncoding Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : BitEncoding Property

Glossary Item Box

Gets the bit encoding of the message (SevenBit, EightBit, or Binary only).

Syntax

Visual Basic (Declaration)
Public ReadOnly Property BitEncoding As TransferEncoding
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As TransferEncoding

value = instance.BitEncoding
C#
public TransferEncoding BitEncoding {get;}
Managed Extensions for C++
public: __property TransferEncoding get_BitEncoding();
C++/CLI
public:
property TransferEncoding BitEncoding {
   TransferEncoding get();
}

Remarks

Mail messages are usually encoded as 7bit, to be compatible with any mail server and transport (the original SMTP specification required 7bit processing). ESMTP, however, provided a mechanism where a server can advertise binary and 8bit support (RFC 3030 supports BINARY data and RFC 6152 supports 8BIT data). BINARY data does not comply with RFC 822 line-length restrictions, whereas 8BIT data does. So an image file would be considered BINARY, but a UTF8 encoding that observes line lengths would be considered 8BIT.

The value of this enumeration is limited to TransferEncoding.SevenBit, TransferEncoding.EightBit and TransferEncoding.Binary. If any Part uses TransferEncoding.Binary, then this is returned. Otherwise, if an Part uses TransferEncoding.EightBit, then this is returned. Otherwise, TransferEncoding.SevenBit is returned.

Users should use BINARY and 8BIT encoding with caution, as a downstream server might not support it, causing the message to be rejected.

See Also

Reference

MailMessage Class
MailMessage Members


Cc Property

[image]
PowerTCP Mail for .NET
Cc Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Cc Property

Glossary Item Box

Gets or sets the email address(es) of the "carbon-copy" recipient(s).

Syntax

Visual Basic (Declaration)
Public Property Cc As String
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As String

instance.Cc = value

value = instance.Cc
C#
public string Cc {get; set;}
Managed Extensions for C++
public: __property string* get_Cc();
public: __property void set_Cc(
   string* value
);
C++/CLI
public:
property String^ Cc {
   String^ get();
   void set (    String^ value);
}

Property Value

Decoded email address(es). A comma is used to separate multiple addresses.

Remarks

Gets or sets the "Cc:" header field. This header field indicates the secondary recipient(s) to which the message should be sent. Set to null or empty to remove the header field.

When set, the address format is standardized and the "friendly name" is word-encoded using HeaderDictionary.Encoding.

See Also

Reference

MailMessage Class
MailMessage Members


Date Property

[image]
PowerTCP Mail for .NET
Date Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Date Property

Glossary Item Box

Gets and sets the "Date:" header field.

Syntax

Visual Basic (Declaration)
Public Property Date As Date
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As Date

instance.Date = value

value = instance.Date
C#
public DateTime Date {get; set;}
Managed Extensions for C++
public: __property DateTime get_Date();
public: __property void set_Date(
   DateTime value
);
C++/CLI
public:
property DateTime Date {
   DateTime get();
   void set (    DateTime value);
}

Property Value

DateTime used in the "Date:" header field.

Remarks

Set this property to a DateTime to encode a "Date:" header field. Set to DateTime.MinValue to exclude it from the encoded header.

Initialized to DateTime.Now when a new MailMessage is created.

See Also

Reference

MailMessage Class
MailMessage Members


From Property

[image]
PowerTCP Mail for .NET
From Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : From Property

Glossary Item Box

Gets or sets the email address of who the email is from.

Syntax

Visual Basic (Declaration)
Public Property From As String
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As String

instance.From = value

value = instance.From
C#
public string From {get; set;}
Managed Extensions for C++
public: __property string* get_From();
public: __property void set_From(
   string* value
);
C++/CLI
public:
property String^ From {
   String^ get();
   void set (    String^ value);
}

Property Value

Decoded email address.

Remarks

Gets or sets the "From:" header field. Set to null or empty to remove the header field from the header.

When set, the address format is standardized and the "friendly name" is word-encoded using HeaderDictionary.Encoding.

See Also

Reference

MailMessage Class
MailMessage Members


IsMime Property

[image]
PowerTCP Mail for .NET
IsMime Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : IsMime Property

Glossary Item Box

Gets or sets a value that controls the use of MIME encoding.

Syntax

Visual Basic (Declaration)
Public Property IsMime As Boolean
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As Boolean

instance.IsMime = value

value = instance.IsMime
C#
public bool IsMime {get; set;}
Managed Extensions for C++
public: __property bool get_IsMime();
public: __property void set_IsMime(
   bool value
);
C++/CLI
public:
property bool IsMime {
   bool get();
   void set (    bool value);
}

Remarks

For a decoded message this value indicates whether a "MIME-Version" or "Content-Type" header field is present. Defaults to true for a new message ("MIME-Version" and "Content-Type" fields are included in the header). To encode to an RFC822 message using pre-MIME UUENCODE for encoding attachments, set to false (which removes the "MIME-Version" and "Content-Type" fields).

See Also

Reference

MailMessage Class
MailMessage Members


IsSecure Property

[image]
PowerTCP Mail for .NET
IsSecure Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : IsSecure Property

Glossary Item Box

Returns false if SecureEncoding is SecureEncoding.None, otherwise true.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property IsSecure As Boolean
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As Boolean

value = instance.IsSecure
C#
public bool IsSecure {get;}
Managed Extensions for C++
public: __property bool get_IsSecure();
C++/CLI
public:
property bool IsSecure {
   bool get();
}

Remarks

S/MIME encoding can be decoded using SecureDecode and SecureDecode(X509Certificate2Collection,Boolean).

See Also

Reference

MailMessage Class
MailMessage Members


Priority Property

[image]
PowerTCP Mail for .NET
Priority Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Priority Property

Glossary Item Box

Gets or sets the Priority of the message.

Syntax

Visual Basic (Declaration)
Public Property Priority As Priority
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As Priority

instance.Priority = value

value = instance.Priority
C#
public Priority Priority {get; set;}
Managed Extensions for C++
public: __property Priority get_Priority();
public: __property void set_Priority(
   Priority value
);
C++/CLI
public:
property Priority Priority {
   Priority get();
   void set (    Priority value);
}

Property Value

Priority enum value indicates the priority level of the message. Defaults to Priority.None.

Remarks

Priority.None indicates the "Priority" header fields is not used. Otherwise, the "Priority" header field is use.

See Also

Reference

MailMessage Class
MailMessage Members


ReplyTo Property

[image]
PowerTCP Mail for .NET
ReplyTo Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : ReplyTo Property

Glossary Item Box

Gets or sets the email address(es) of where any reply should be sent.

Syntax

Visual Basic (Declaration)
Public Property ReplyTo As String
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As String

instance.ReplyTo = value

value = instance.ReplyTo
C#
public string ReplyTo {get; set;}
Managed Extensions for C++
public: __property string* get_ReplyTo();
public: __property void set_ReplyTo(
   string* value
);
C++/CLI
public:
property String^ ReplyTo {
   String^ get();
   void set (    String^ value);
}

Property Value

Decoded email address(es). A comma-delimited string is used for multiple addresses. Decoded email address(es). A comma is used to separate multiple addresses.

Remarks

Gets or sets the "Reply-To:" header field. This header field indicates the recipient(s) to which any reply should be sent. Setting this property to null or empty will remove the header field from the header.

When set, the address format is standardized and the "friendly name" is word-encoded using HeaderDictionary.Encoding.

See Also

Reference

MailMessage Class
MailMessage Members


SecureEncoding Property

[image]
PowerTCP Mail for .NET
SecureEncoding Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : SecureEncoding Property

Glossary Item Box

Indicates the type of S/MIME encoding exposed by the header. Any "inner" encoding is unknown.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property SecureEncoding As SecureEncoding
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As SecureEncoding

value = instance.SecureEncoding
C#
public SecureEncoding SecureEncoding {get;}
Managed Extensions for C++
public: __property SecureEncoding get_SecureEncoding();
C++/CLI
public:
property SecureEncoding SecureEncoding {
   SecureEncoding get();
}

Property Value

SecureEncoding.

Remarks

S/MIME encoding can be decoded using SecureDecode and SecureDecode(X509Certificate2Collection,Boolean).

See Also

Reference

MailMessage Class
MailMessage Members


Sender Property

[image]
PowerTCP Mail for .NET
Sender Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Sender Property

Glossary Item Box

Gets or sets the email address of the sender of the email.

Syntax

Visual Basic (Declaration)
Public Property Sender As String
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As String

instance.Sender = value

value = instance.Sender
C#
public string Sender {get; set;}
Managed Extensions for C++
public: __property string* get_Sender();
public: __property void set_Sender(
   string* value
);
C++/CLI
public:
property String^ Sender {
   String^ get();
   void set (    String^ value);
}

Property Value

Decoded email address. Decoded email address.

Remarks

Setting this property adds the "Sender:" header line to the message. It should be included if the From includes multiple addresses, or the sending agent is different. Setting this property to null or empty will remove the header field from the header.

When set, the address format is standardized and the "friendly name" is word-encoded using HeaderDictionary.Encoding.

See Also

Reference

MailMessage Class
MailMessage Members


Subject Property

[image]
PowerTCP Mail for .NET
Subject Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : Subject Property

Glossary Item Box

Gets or sets the value of the "Subject" header field.

Syntax

Visual Basic (Declaration)
Public Property Subject As String
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As String

instance.Subject = value

value = instance.Subject
C#
public string Subject {get; set;}
Managed Extensions for C++
public: __property string* get_Subject();
public: __property void set_Subject(
   string* value
);
C++/CLI
public:
property String^ Subject {
   String^ get();
   void set (    String^ value);
}

Property Value

A string representing the header field body following the "Subject: " header field name.

Remarks

This property is a convenient alternative to referencing Header[HeaderKey.Subject].Value.

See Also

Reference

MailMessage Class
MailMessage Members


To Property

[image]
PowerTCP Mail for .NET
To Property
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : To Property

Glossary Item Box

Gets or sets the email address(es) of the primary recipient(s).

Syntax

Visual Basic (Declaration)
Public Property To As String
Visual Basic (Usage) Copy Code
Dim instance As MailMessage
Dim value As String

instance.To = value

value = instance.To
C#
public string To {get; set;}
Managed Extensions for C++
public: __property string* get_To();
public: __property void set_To(
   string* value
);
C++/CLI
public:
property String^ To {
   String^ get();
   void set (    String^ value);
}

Property Value

Decoded email address(es). A comma is used to separate multiple addresses.

Remarks

Gets or sets the "To:" header field, indicating the recipient(s) to which the message should be sent. Set to null or empty to remove the header field.

When set, the address format is standardized and the "friendly name" is word-encoded using HeaderDictionary.Encoding.

See Also

Reference

MailMessage Class
MailMessage Members


MailMessage Class Fields

[image]
PowerTCP Mail for .NET
MailMessage Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : MailMessage Class

Glossary Item Box

For a list of all members of this type, see MailMessage members.

Public Fields

 | Name | Description
static (Shared in Visual Basic) | MaxEncodedLineLength | The maximum length for an encoded email line. Header lines are "folded" IAW RFC 2822. Body text will have CR/LF's inserted between encoded characters.
Top

See Also

Reference

MailMessage Class
Dart.Mail Namespace


MaxEncodedLineLength Field

[image]
PowerTCP Mail for .NET
MaxEncodedLineLength Field
See Also Send comments on this topic
Dart.Mail Namespace > MailMessage Class : MaxEncodedLineLength Field

Glossary Item Box

The maximum length for an encoded email line. Header lines are "folded" IAW RFC 2822. Body text will have CR/LF's inserted between encoded characters.

Syntax

Visual Basic (Declaration)
Public Shared MaxEncodedLineLength As Integer
Visual Basic (Usage) Copy Code
Dim value As Integer

value = MailMessage.MaxEncodedLineLength

MailMessage.MaxEncodedLineLength = value
C#
public static int MaxEncodedLineLength
Managed Extensions for C++
public: static int MaxEncodedLineLength
C++/CLI
public:
static int MaxEncodedLineLength

Remarks

Defaults to the RFC 2822 "requirement" of 998. Set to 78 to comply with the RFC 2822 "recommendation".

See Also

Reference

MailMessage Class
MailMessage Members


MailSecurity Class

[image]
PowerTCP Mail for .NET
MailSecurity Class
Members See Also Send comments on this topic
Dart.Mail Namespace : MailSecurity Class

Glossary Item Box

Specializes ClientSecurity with configuration properties used by Mail connections.

Object Model

MailSecurity Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class MailSecurity
   Inherits ClientSecurity
Visual Basic (Usage) Copy Code
Dim instance As MailSecurity
C#
[Serializable()]
public class MailSecurity : ClientSecurity
Managed Extensions for C++
[Serializable()]
public __gc class MailSecurity : public ClientSecurity
C++/CLI
[Serializable()]
public ref class MailSecurity : public ClientSecurity

Inheritance Hierarchy

System.Object
Dart.Mail.Security
Dart.Mail.ClientSecurity
Dart.Mail.MailSecurity

See Also

Reference

MailSecurity Members
Dart.Mail Namespace


MailSecurity Class Members

[image]
PowerTCP Mail for .NET
MailSecurity Class Members
See Also Fields Properties Send comments on this topic
Dart.Mail Namespace : MailSecurity Class

Glossary Item Box

The following tables list the members exposed by MailSecurity.

Public Constructors

 | Name | Description
Public Constructor | MailSecurity Constructor |
Top

Public Fields

 | Name | Description
Public Field | SelectionCallback | The delegate that executes to permit selection of a cient certificate. (Inherited from Dart.Mail.ClientSecurity)
Public Field | ValidationCallback | The delegate that executes after the server provides its certificate to the client. (Inherited from Dart.Mail.Security)
Top

Public Properties

 | Name | Description
Public Property | Certificates | Gets or sets a collection of client certificates to use during authentication. (Inherited from Dart.Mail.ClientSecurity)
Public Property | CheckCertificateRevocation | Indicates whether the certificate revocation list is checked during authentication. (Inherited from Dart.Mail.Security)
Public Property | Encrypt | Gets or sets a value that controls how the connection is encrypted.
Public Property | Protocols | Gets or sets the SSLProtocols available. (Inherited from Dart.Mail.Security)
Public Property | TargetHost | Gets or sets the remote host to be authenticated. (Inherited from Dart.Mail.ClientSecurity)
Top

See Also

Reference

MailSecurity Class
Dart.Mail Namespace


MailSecurity Constructor

[image]
PowerTCP Mail for .NET
MailSecurity Constructor
See Also Send comments on this topic
Dart.Mail Namespace > MailSecurity Class : MailSecurity Constructor

Glossary Item Box

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New MailSecurity()
C#
public MailSecurity()
Managed Extensions for C++
public: MailSecurity();
C++/CLI
public:
MailSecurity();

See Also

Reference

MailSecurity Class
MailSecurity Members


MailSecurity Class Properties

[image]
PowerTCP Mail for .NET
MailSecurity Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : MailSecurity Class

Glossary Item Box

For a list of all members of this type, see MailSecurity members.

Public Properties

 | Name | Description
Public Property | Certificates | Gets or sets a collection of client certificates to use during authentication. (Inherited from Dart.Mail.ClientSecurity)
Public Property | CheckCertificateRevocation | Indicates whether the certificate revocation list is checked during authentication. (Inherited from Dart.Mail.Security)
Public Property | Encrypt | Gets or sets a value that controls how the connection is encrypted.
Public Property | Protocols | Gets or sets the SSLProtocols available. (Inherited from Dart.Mail.Security)
Public Property | TargetHost | Gets or sets the remote host to be authenticated. (Inherited from Dart.Mail.ClientSecurity)
Top

See Also

Reference

MailSecurity Class
Dart.Mail Namespace


Encrypt Property

[image]
PowerTCP Mail for .NET
Encrypt Property
See Also Send comments on this topic
Dart.Mail Namespace > MailSecurity Class : Encrypt Property

Glossary Item Box

Gets or sets a value that controls how the connection is encrypted.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Encrypt As Encrypt
Visual Basic (Usage) Copy Code
Dim instance As MailSecurity
Dim value As Encrypt

instance.Encrypt = value

value = instance.Encrypt
C#
[DefaultValue()]
public Encrypt Encrypt {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property Encrypt get_Encrypt();
public: __property void set_Encrypt(
   Encrypt value
);
C++/CLI
[DefaultValue()]
public:
property Encrypt Encrypt {
   Encrypt get();
   void set (    Encrypt value);
}

See Also

Reference

MailSecurity Class
MailSecurity Members


MailSession Class

[image]
PowerTCP Mail for .NET
MailSession Class
Members See Also Send comments on this topic
Dart.Mail Namespace : MailSession Class

Glossary Item Box

Holds configuration common to all email transport protocols.

Object Model

MailSession ClassIPEndPoint ClassProxy ClassIPEndPoint ClassMailSecurity Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class MailSession
   Inherits AuthenticatedSession
Visual Basic (Usage) Copy Code
Dim instance As MailSession
C#
[Serializable()]
public class MailSession : AuthenticatedSession
Managed Extensions for C++
[Serializable()]
public __gc class MailSession : public AuthenticatedSession
C++/CLI
[Serializable()]
public ref class MailSession : public AuthenticatedSession

Inheritance Hierarchy

System.Object
Dart.Mail.Session
Dart.Mail.TcpSession
Dart.Mail.AuthenticatedSession
Dart.Mail.MailSession
Dart.Mail.ImapSession
Dart.Mail.SmtpSession

See Also

Reference

MailSession Members
Dart.Mail Namespace


MailSession Class Members

[image]
PowerTCP Mail for .NET
MailSession Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : MailSession Class

Glossary Item Box

The following tables list the members exposed by MailSession.

Public Constructors

 | Name | Description
Public Constructor | MailSession Constructor | Default constructor.
Top

Public Properties

 | Name | Description
Public Property | Authentication | Authentication technique to use. Defaults to Authentication.Auto.
Public Property | BlockSize | Gets or sets the buffer size used during file and socket I/O.
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out. (Inherited from Dart.Mail.TcpSession)
Public Property | Domain | Gets or sets the domain (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Password | Gets or sets the password or OAuth access token used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Proxy | Defines the optional server proxy configuration. (Inherited from Dart.Mail.TcpSession)
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the privacy parameters to use with the mail server. See the MailSecurity class for more information.
Public Property | ServicePrincipleName | Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Username | Gets or sets the username used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Top

Public Methods

 | Name | Description
Public Method | Clone | Creates a deep copy of the Session.
Top

See Also

Reference

MailSession Class
Dart.Mail Namespace


MailSession Constructor

[image]
PowerTCP Mail for .NET
MailSession Constructor
See Also Send comments on this topic
Dart.Mail Namespace > MailSession Class : MailSession Constructor

Glossary Item Box

Default constructor.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New MailSession()
C#
public MailSession()
Managed Extensions for C++
public: MailSession();
C++/CLI
public:
MailSession();

See Also

Reference

MailSession Class
MailSession Members


MailSession Class Methods

[image]
PowerTCP Mail for .NET
MailSession Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : MailSession Class

Glossary Item Box

For a list of all members of this type, see MailSession members.

Public Methods

 | Name | Description
Public Method | Clone | Creates a deep copy of the Session.
Top

See Also

Reference

MailSession Class
Dart.Mail Namespace


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > MailSession Class : Clone Method

Glossary Item Box

Creates a deep copy of the Session.

Syntax

Visual Basic (Declaration)
Public Overridable Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As MailSession
Dim value As Object

value = instance.Clone()
C#
public virtual object Clone()
Managed Extensions for C++
public: virtual Object* Clone();
C++/CLI
public:
virtual Object^ Clone();

Return Value

A new MailSession.

See Also

Reference

MailSession Class
MailSession Members


MailSession Class Properties

[image]
PowerTCP Mail for .NET
MailSession Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : MailSession Class

Glossary Item Box

For a list of all members of this type, see MailSession members.

Public Properties

 | Name | Description
Public Property | Authentication | Authentication technique to use. Defaults to Authentication.Auto.
Public Property | BlockSize | Gets or sets the buffer size used during file and socket I/O.
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out. (Inherited from Dart.Mail.TcpSession)
Public Property | Domain | Gets or sets the domain (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Password | Gets or sets the password or OAuth access token used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Proxy | Defines the optional server proxy configuration. (Inherited from Dart.Mail.TcpSession)
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the privacy parameters to use with the mail server. See the MailSecurity class for more information.
Public Property | ServicePrincipleName | Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Username | Gets or sets the username used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Top

See Also

Reference

MailSession Class
Dart.Mail Namespace


Authentication Property

[image]
PowerTCP Mail for .NET
Authentication Property
See Also Send comments on this topic
Dart.Mail Namespace > MailSession Class : Authentication Property

Glossary Item Box

Authentication technique to use. Defaults to Authentication.Auto.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Authentication As Authentication
Visual Basic (Usage) Copy Code
Dim instance As MailSession
Dim value As Authentication

instance.Authentication = value

value = instance.Authentication
C#
[DefaultValue()]
public Authentication Authentication {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property Authentication get_Authentication();
public: __property void set_Authentication(
   Authentication value
);
C++/CLI
[DefaultValue()]
public:
property Authentication Authentication {
   Authentication get();
   void set (    Authentication value);
}

See Also

Reference

MailSession Class
MailSession Members


BlockSize Property

[image]
PowerTCP Mail for .NET
BlockSize Property
See Also Send comments on this topic
Dart.Mail Namespace > MailSession Class : BlockSize Property

Glossary Item Box

Gets or sets the buffer size used during file and socket I/O.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property BlockSize As Integer
Visual Basic (Usage) Copy Code
Dim instance As MailSession
Dim value As Integer

instance.BlockSize = value

value = instance.BlockSize
C#
[DefaultValue()]
public int BlockSize {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_BlockSize();
public: __property void set_BlockSize(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int BlockSize {
   int get();
   void set (    int value);
}

Remarks

Progress, Progress and Progress are raised each time a block is read or written.

See Also

Reference

MailSession Class
MailSession Members


Security Property

[image]
PowerTCP Mail for .NET
Security Property
See Also Send comments on this topic
Dart.Mail Namespace > MailSession Class : Security Property

Glossary Item Box

Specifies the privacy parameters to use with the mail server. See the MailSecurity class for more information.

Syntax

Visual Basic (Declaration)
Public Shadows Property Security As MailSecurity
Visual Basic (Usage) Copy Code
Dim instance As MailSession
Dim value As MailSecurity

instance.Security = value

value = instance.Security
C#
public new MailSecurity Security {get; set;}
Managed Extensions for C++
public: __property new MailSecurity* get_Security();
public: __property new void set_Security(
   MailSecurity* value
);
C++/CLI
public:
new property MailSecurity^ Security {
   MailSecurity^ get();
   void set (    MailSecurity^ value);
}

Property Value

MailSecurity

See Also

Reference

MailSession Class
MailSession Members


MessageBase Class

[image]
PowerTCP Mail for .NET
MessageBase Class
Members See Also Send comments on this topic
Dart.Mail Namespace : MessageBase Class

Glossary Item Box

Abstract base class for server-side mail messages.

Object Model

MessageBase ClassMailMessage Class

Syntax

Visual Basic (Declaration)
Public MustInherit Class MessageBase
Visual Basic (Usage) Copy Code
Dim instance As MessageBase
C#
public abstract class MessageBase
Managed Extensions for C++
public __gc abstract class MessageBase
C++/CLI
public ref class MessageBase abstract

Inheritance Hierarchy

System.Object
Dart.Mail.MessageBase
Dart.Mail.ImapMessage
Dart.Mail.PopMessage

See Also

Reference

MessageBase Members
Dart.Mail Namespace


MessageBase Class Members

[image]
PowerTCP Mail for .NET
MessageBase Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : MessageBase Class

Glossary Item Box

The following tables list the members exposed by MessageBase.

Public Properties

 | Name | Description
Public Property | Id | Returns the Id of the message.
Public Property | Message | Used for referencing the downloaded MailMessage.
Public Property | Size | The size of the message in bytes.
Public Property | Tag | Gets or sets an object reference that can be used to associate this instance with any other object.
Public Property | Uid | Returns the unique identifier of the message.
Top

See Also

Reference

MessageBase Class
Dart.Mail Namespace


MessageBase Class Properties

[image]
PowerTCP Mail for .NET
MessageBase Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : MessageBase Class

Glossary Item Box

For a list of all members of this type, see MessageBase members.

Public Properties

 | Name | Description
Public Property | Id | Returns the Id of the message.
Public Property | Message | Used for referencing the downloaded MailMessage.
Public Property | Size | The size of the message in bytes.
Public Property | Tag | Gets or sets an object reference that can be used to associate this instance with any other object.
Public Property | Uid | Returns the unique identifier of the message.
Top

See Also

Reference

MessageBase Class
Dart.Mail Namespace


Id Property

[image]
PowerTCP Mail for .NET
Id Property
See Also Send comments on this topic
Dart.Mail Namespace > MessageBase Class : Id Property

Glossary Item Box

Returns the Id of the message.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Id As Integer
Visual Basic (Usage) Copy Code
Dim instance As MessageBase
Dim value As Integer

value = instance.Id
C#
public int Id {get;}
Managed Extensions for C++
public: __property int get_Id();
C++/CLI
public:
property int Id {
   int get();
}

Property Value

An integer representing the identification number of the message.

Remarks

MessageBase.Id is initialized at login to an auto-incremented integer, ranging from 1 to number of messages. This property is useful for referring to a particular message within your application. Note: MessageBase.Id is 1-based and any containing list is 0-based, so to access the message with an Id 1 you will access List[0].

This value may change as messages are added or removed.

See Also

Reference

MessageBase Class
MessageBase Members


Message Property

[image]
PowerTCP Mail for .NET
Message Property
See Also Send comments on this topic
Dart.Mail Namespace > MessageBase Class : Message Property

Glossary Item Box

Used for referencing the downloaded MailMessage.

Syntax

Visual Basic (Declaration)
Public Property Message As MailMessage
Visual Basic (Usage) Copy Code
Dim instance As MessageBase
Dim value As MailMessage

instance.Message = value

value = instance.Message
C#
public MailMessage Message {get; set;}
Managed Extensions for C++
public: __property MailMessage* get_Message();
public: __property void set_Message(
   MailMessage* value
);
C++/CLI
public:
property MailMessage^ Message {
   MailMessage^ get();
   void set (    MailMessage^ value);
}

Property Value

A decoded MailMessage.

See Also

Reference

MessageBase Class
MessageBase Members


Size Property

[image]
PowerTCP Mail for .NET
Size Property
See Also Send comments on this topic
Dart.Mail Namespace > MessageBase Class : Size Property

Glossary Item Box

The size of the message in bytes.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Size As Long
Visual Basic (Usage) Copy Code
Dim instance As MessageBase
Dim value As Long

value = instance.Size
C#
public long Size {get;}
Managed Extensions for C++
public: __property long get_Size();
C++/CLI
public:
property int64 Size {
   int64 get();
}

Property Value

An integer representing the size of the message in bytes.

See Also

Reference

MessageBase Class
MessageBase Members


Tag Property

[image]
PowerTCP Mail for .NET
Tag Property
See Also Send comments on this topic
Dart.Mail Namespace > MessageBase Class : Tag Property

Glossary Item Box

Gets or sets an object reference that can be used to associate this instance with any other object.

Syntax

Visual Basic (Declaration)
Public Property Tag As Object
Visual Basic (Usage) Copy Code
Dim instance As MessageBase
Dim value As Object

instance.Tag = value

value = instance.Tag
C#
public object Tag {get; set;}
Managed Extensions for C++
public: __property Object* get_Tag();
public: __property void set_Tag(
   Object* value
);
C++/CLI
public:
property Object^ Tag {
   Object^ get();
   void set (    Object^ value);
}

Property Value

Any object that is associated with the object, null if no objects are associated with the object.

Remarks

See Also

Reference

MessageBase Class
MessageBase Members


Uid Property

[image]
PowerTCP Mail for .NET
Uid Property
See Also Send comments on this topic
Dart.Mail Namespace > MessageBase Class : Uid Property

Glossary Item Box

Returns the unique identifier of the message.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Uid As String
Visual Basic (Usage) Copy Code
Dim instance As MessageBase
Dim value As String

value = instance.Uid
C#
public string Uid {get;}
Managed Extensions for C++
public: __property string* get_Uid();
C++/CLI
public:
property String^ Uid {
   String^ get();
}

Property Value

A string representing the server-defined unique identifier for the message.

Remarks

The unique ID of this message. This is used for accessing this message in a manner which cannot be affected by server-side removal of other messages (The Object.Id property does not guarantee this). The uniqueness of the identifier varies depending on the mail protocol used for this message (ex. IMAP UIDs are guaranteed unique on a per-mailbox basis only).

See Also

Reference

MessageBase Class
MessageBase Members


Messagepart Class

[image]
PowerTCP Mail for .NET
Messagepart Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Messagepart Class

Glossary Item Box

A MIME part that has a "Content-Type: message/rfc822" header label and does not have "Content-Disposition: attachment" header label.

Object Model

Messagepart ClassMailMessage ClassContentDisposition ClassContentType ClassHeaderDictionary ClassHeaderField Class

Syntax

Visual Basic (Declaration)
Public Class Messagepart
   Inherits Resource
Visual Basic (Usage) Copy Code
Dim instance As Messagepart
C#
public class Messagepart : Resource
Managed Extensions for C++
public __gc class Messagepart : public Resource
C++/CLI
public ref class Messagepart : public Resource

Remarks

This class represents a MailMessage that has been forwarded or is being forwarded for viewing "inline". An Attachment is used to represent a MailMessage that has been forwarded or is being forwarded as an attachment.

Inheritance Hierarchy

System.Object
Dart.Mail.Part
Dart.Mail.Resource
Dart.Mail.Messagepart

See Also

Reference

Messagepart Members
Dart.Mail Namespace


Messagepart Class Members

[image]
PowerTCP Mail for .NET
Messagepart Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : Messagepart Class

Glossary Item Box

The following tables list the members exposed by Messagepart.

Public Constructors

 | Name | Description
Public Constructor | Messagepart Constructor | Overloaded.
Top

Public Properties

 | Name | Description
Public Property | Content | The decoded MailMessage that is included as an inline part.
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part. (Inherited from Dart.Mail.Resource)
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part. (Inherited from Dart.Mail.Resource)
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | FileName | Gets and sets ContentDisposition.FileName and ContentType.Name.
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part. (Inherited from Dart.Mail.Resource)
Top

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values. (Inherited from Dart.Mail.Resource)
Public Method | Clone | Overridden. Creates a deep copy of the Messagepart, but a clone of its Content.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content. (Inherited from Dart.Mail.Resource)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Resource)
Public Method | GetContentStream | Overridden. Gets a Stream for reading or writing of content data.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType. (Inherited from Dart.Mail.Resource)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Messagepart Class
Dart.Mail Namespace


Messagepart Constructor

[image]
PowerTCP Mail for .NET
Messagepart Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class : Messagepart Constructor

Glossary Item Box

Overload List

Overload | Description
Messagepart Constructor(MailMessage,String) | Create a new Messagepart and initialize Content it with a MailMessage.
Messagepart Constructor() | Create a new Messagepart.

See Also

Reference

Messagepart Class
Messagepart Members


Messagepart Constructor(MailMessage,String)

[image]
PowerTCP Mail for .NET
Messagepart Constructor(MailMessage,String)
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class > Messagepart Constructor : Messagepart Constructor(MailMessage,String)

message
Initializes Content.
fileName
Initializes ContentType.Name and ContentDisposition.FileName.

Glossary Item Box

Create a new Messagepart and initialize Content it with a MailMessage.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal message As MailMessage, _
   ByVal fileName As String _
)
Visual Basic (Usage) Copy Code
Dim message As MailMessage
Dim fileName As String

Dim instance As New Messagepart(message, fileName)
C#
public Messagepart(
   MailMessage message,
   string fileName
)
Managed Extensions for C++
public: Messagepart(
   MailMessage* message,
   string* fileName
)
C++/CLI
public:
Messagepart(
   MailMessage^ message,
   String^ fileName
)

Parameters

message
Initializes Content.
fileName
Initializes ContentType.Name and ContentDisposition.FileName.

Remarks

ContentType.MediaType is "message/rfc822", TransferEncoding is TransferEncoding.SevenBit and ContentDisposition.Inline is true (use a new Attachment to include a MailMessage as an attachment).

See Also

Reference

Messagepart Class
Messagepart Members
Overload List


Messagepart Constructor()

[image]
PowerTCP Mail for .NET
Messagepart Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class > Messagepart Constructor : Messagepart Constructor()

Glossary Item Box

Create a new Messagepart.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Messagepart()
C#
public Messagepart()
Managed Extensions for C++
public: Messagepart();
C++/CLI
public:
Messagepart();

Remarks

ContentType.MediaType is "message/rfc822", TransferEncoding is TransferEncoding.SevenBit and ContentDisposition.Inline is true (use a new Attachment to include a MailMessage as an attachment).

See Also

Reference

Messagepart Class
Messagepart Members
Overload List


Messagepart Class Methods

[image]
PowerTCP Mail for .NET
Messagepart Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Messagepart Class

Glossary Item Box

For a list of all members of this type, see Messagepart members.

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values. (Inherited from Dart.Mail.Resource)
Public Method | Clone | Overridden. Creates a deep copy of the Messagepart, but a clone of its Content.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content. (Inherited from Dart.Mail.Resource)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Resource)
Public Method | GetContentStream | Overridden. Gets a Stream for reading or writing of content data.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType. (Inherited from Dart.Mail.Resource)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Messagepart Class
Dart.Mail Namespace


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class : Clone Method

Glossary Item Box

Creates a deep copy of the Messagepart, but a clone of its Content.

Syntax

Visual Basic (Declaration)
Public Overrides Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As Messagepart
Dim value As Object

value = instance.Clone()
C#
public override object Clone()
Managed Extensions for C++
public: Object* Clone(); override
C++/CLI
public:
Object^ Clone(); override

Return Value

A Messagepart

Remarks

Note: Calling Dispose() on the original or cloned Messagepart will dispose of any shallow-copied parts that the original and clone reference.

See Also

Reference

Messagepart Class
Messagepart Members


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class : Dispose Method

Glossary Item Box

Releases all resources associated with the object.

Overload List

Overload | Description
Dispose(Boolean) | Releases all resources associated with the object.
Dispose() | Releases all resources associated with the object. (Inherited from Dart.Mail.Part)

See Also

Reference

Messagepart Class
Messagepart Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As Messagepart
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method releases all resources and deletes any unmoved decoded attachments.

See Also

Reference

Messagepart Class
Messagepart Members
Overload List


GetContentStream Method

[image]
PowerTCP Mail for .NET
GetContentStream Method
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class : GetContentStream Method

Glossary Item Box

Gets a Stream for reading or writing of content data.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetContentStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As Messagepart
Dim value As Stream

value = instance.GetContentStream()
C#
public override Stream GetContentStream()
Managed Extensions for C++
public: Stream* GetContentStream(); override
C++/CLI
public:
Stream^ GetContentStream(); override

Remarks

Content provides the source and destination of content data.

If Content is null, then decoding is assumed and a new MailMessage is created by the decoder and populated when Stream.Write is used.

If Content is not null, then encoding is assumed and Content is encoded when Stream.Read is used.

See Also

Reference

Messagepart Class
Messagepart Members


Messagepart Class Properties

[image]
PowerTCP Mail for .NET
Messagepart Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Messagepart Class

Glossary Item Box

For a list of all members of this type, see Messagepart members.

Public Properties

 | Name | Description
Public Property | Content | The decoded MailMessage that is included as an inline part.
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part. (Inherited from Dart.Mail.Resource)
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part. (Inherited from Dart.Mail.Resource)
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | FileName | Gets and sets ContentDisposition.FileName and ContentType.Name.
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part. (Inherited from Dart.Mail.Resource)
Top

See Also

Reference

Messagepart Class
Dart.Mail Namespace


Content Property

[image]
PowerTCP Mail for .NET
Content Property
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class : Content Property

Glossary Item Box

The decoded MailMessage that is included as an inline part.

Syntax

Visual Basic (Declaration)
Public Shadows Property Content As MailMessage
Visual Basic (Usage) Copy Code
Dim instance As Messagepart
Dim value As MailMessage

instance.Content = value

value = instance.Content
C#
public new MailMessage Content {get; set;}
Managed Extensions for C++
public: __property new MailMessage* get_Content();
public: __property new void set_Content(
   MailMessage* value
);
C++/CLI
public:
new property MailMessage^ Content {
   MailMessage^ get();
   void set (    MailMessage^ value);
}

See Also

Reference

Messagepart Class
Messagepart Members


FileName Property

[image]
PowerTCP Mail for .NET
FileName Property
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class : FileName Property

Glossary Item Box

Gets and sets ContentDisposition.FileName and ContentType.Name.

Syntax

Visual Basic (Declaration)
Public Property FileName As String
Visual Basic (Usage) Copy Code
Dim instance As Messagepart
Dim value As String

instance.FileName = value

value = instance.FileName
C#
public string FileName {get; set;}
Managed Extensions for C++
public: __property string* get_FileName();
public: __property void set_FileName(
   string* value
);
C++/CLI
public:
property String^ FileName {
   String^ get();
   void set (    String^ value);
}

Remarks

Returns ContentType.Name if ContentDisposition.FileName is null or empty.

See Also

Reference

Messagepart Class
Messagepart Members


Length Property

[image]
PowerTCP Mail for .NET
Length Property
See Also Send comments on this topic
Dart.Mail Namespace > Messagepart Class : Length Property

Glossary Item Box

Returns the approximate Length of the encoded part.

Syntax

Visual Basic (Declaration)
Public Overrides ReadOnly Property Length As Long
Visual Basic (Usage) Copy Code
Dim instance As Messagepart
Dim value As Long

value = instance.Length
C#
public override long Length {get;}
Managed Extensions for C++
public: __property long get_Length() override;
C++/CLI
public:
property int64 Length {
   int64 get() override;
}

See Also

Reference

Messagepart Class
Messagepart Members


Multipart Class

[image]
PowerTCP Mail for .NET
Multipart Class
Members Example See Also Send comments on this topic
Dart.Mail Namespace : Multipart Class

Glossary Item Box

Implements base functionality for all multi-part mail parts.

Object Model

Multipart ClassContentType ClassHeaderDictionary ClassHeaderField ClassMultipartContent ClassPart Class

Syntax

Visual Basic (Declaration)
Public Class Multipart
   Inherits Part
Visual Basic (Usage) Copy Code
Dim instance As Multipart
C#
public class Multipart : Part
Managed Extensions for C++
public __gc class Multipart : public Part
C++/CLI
public ref class Multipart : public Part

Example

This example demonstrates how to add parts to a message. First, a "multipartalternative" part containing two alternative text parts is added. Second, a resource part containing an image is added.
C# Copy Code
private MailMessage addCustomParts(MailMessage message)
{
    //Add custom header field to message
    message.Headers.Add("X-Alt-Message", new HeaderField("X-Alt-Message", "Message with Alternatives"));

    //Create and add alternative parts to a multipart part
    Textpart part1 = new Textpart("This is alternative 1.");
    part1.Headers.Add("X-Alt", new HeaderField("X-Alt", "Alternative 1"));

    Textpart part2 = new Textpart("This is alternative 2.");
    part2.Headers.Add("X-Alt", new HeaderField("X-Alt", "Alternative 2"));

    Multipart multipart = new Multipart(Multipart.Alternative);
    multipart.Parts.Add(part1);
    multipart.Parts.Add(part2);

    //Add a MultiPart to the MailMessage
    message.Parts.Add(multipart);

    //Add a Resource part to the MailMessage
    Resource resource = new Resource(new FileStream(Application.StartupPath + "\\myImage.jpg", FileMode.Open), "myImage.jpg");
    resource.ContentType = new ContentType("image/jpeg");
    resource.ContentId = "<myImage>";
    message.Parts.Add(resource);
    return message;
}
Visual Basic Copy Code
Private Function addCustomParts(ByVal message As MailMessage) As MailMessage
    'Add custom header field to message
    message.Headers.Add("X-Alt-Message", New HeaderField("X-Alt-Message", "Message with Alternatives"))

    'Create and add alternative parts to a multipart part
    Dim part1 As New Textpart("This is alternative 1.")
    part1.Headers.Add("X-Alt", New HeaderField("X-Alt", "Alternative 1"))

    Dim part2 As New Textpart("This is alternative 2.")
    part2.Headers.Add("X-Alt", New HeaderField("X-Alt", "Alternative 2"))

    Dim multipart As New Multipart(Dart.Mail.Multipart.Alternative)
    multipart.Parts.Add(part1)
    multipart.Parts.Add(part2)

    'Add a MultiPart to the MailMessage
    message.Parts.Add(multipart)

    'Add a Resource part to the MailMessage
    Dim resource As New Resource(New FileStream(Application.StartupPath & "\myImage.jpg", FileMode.Open), "myImage.jpg")
    resource.ContentType = New ContentType("image/jpeg")
    resource.ContentId = "<myImage>"
    message.Parts.Add(resource)
    Return message
End Function

Inheritance Hierarchy

System.Object
Dart.Mail.Part
Dart.Mail.Multipart
Dart.Mail.MailMessage

See Also

Reference

Multipart Members
Dart.Mail Namespace


Multipart Class Members

[image]
PowerTCP Mail for .NET
Multipart Class Members
See Also Fields Properties Methods Send comments on this topic
Dart.Mail Namespace : Multipart Class

Glossary Item Box

The following tables list the members exposed by Multipart.

Public Constructors

 | Name | Description
Public Constructor | Multipart Constructor | Overloaded.
Top

Public Fields

 | Name | Description
Public Field | Alternative | String used to initialize ContentType.MediaType to "multipart/alternative".
Public Field | Mixed | String used to initialize ContentType.MediaType to "multipart/mixed".
Public Field | Related | String used to initialize ContentType.MediaType to "multipart/related".
Top

Public Properties

 | Name | Description
Public Property | Attachments | Get a generic List containing all the Attachments within this part and sub-parts.
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Html | Gets or sets the HTML text body.
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Parts | A Part list that contains all the parts in the Multipart.
Public Property | Resources | Get a generic List containing all the Resources within this part and sub-parts.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | Text | Gets or sets the plain text body.
Top

Public Methods

 | Name | Description
Public Method | Clear | Overridden. Reinitializes the part to default values.
Public Method | Clone | Overridden. Creates a deep copy of the Multipart, but deep/shallow copies of its Parts. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | FindHtml | Finds the first Htmlpart, recursively searching Parts (depth before breadth).
Public Method | FindParent | Performs a recursive search to find the "parent" Part of the specified child within this Multipart.
Public Method | FindText | Finds the first Textpart, recursively searching Parts (depth before breadth).
Public Method | GetContentEncodingStream | Overridden. Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Multipart Class
Dart.Mail Namespace


Multipart Constructor

[image]
PowerTCP Mail for .NET
Multipart Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Multipart Constructor

Glossary Item Box

Overload List

Overload | Description
Multipart Constructor() | Public constructor used for subsequent encoding.
Multipart Constructor(String,String,FileInfo[]) | Initializes Parts with new Textpart, Htmlpart and linked Resource parts.
Multipart Constructor(String) | Public constructor used for subsequent encoding.

See Also

Reference

Multipart Class
Multipart Members


Multipart Constructor()

[image]
PowerTCP Mail for .NET
Multipart Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class > Multipart Constructor : Multipart Constructor()

Glossary Item Box

Public constructor used for subsequent encoding.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Multipart()
C#
public Multipart()
Managed Extensions for C++
public: Multipart();
C++/CLI
public:
Multipart();

Remarks

ContentType.MediaType is initialized to "multipart/mixed".

See Also

Reference

Multipart Class
Multipart Members
Overload List


Multipart Constructor(String,String,FileInfo[])

[image]
PowerTCP Mail for .NET
Multipart Constructor(String,String,FileInfo[])
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class > Multipart Constructor : Multipart Constructor(String,String,FileInfo[])

text
Used to initialize Text (Parts[0]). If null or empty no Textpart is created.
html
Used to initialize Html (Parts[1]). If null or empty an ArgumentNullException is thrown.
htmlResources
Used to initialized a "multipart/related" part (Parts[1]) that provides linked embedded resources referenced by Html. If null an Htmlpart is created instead.

Glossary Item Box

Initializes Parts with new Textpart, Htmlpart and linked Resource parts.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal text As String, _
   ByVal html As String, _
   ByVal htmlResources() As FileInfo _
)
Visual Basic (Usage) Copy Code
Dim text As String
Dim html As String
Dim htmlResources() As FileInfo

Dim instance As New Multipart(text, html, htmlResources)
C#
public Multipart(
   string text,
   string html,
   FileInfo[] htmlResources
)
Managed Extensions for C++
public: Multipart(
   string* text,
   string* html,
   FileInfo*[]* htmlResources
)
C++/CLI
public:
Multipart(
   String^ text,
   String^ html,
   array<FileInfo^>^ htmlResources
)

Parameters

text
Used to initialize Text (Parts[0]). If null or empty no Textpart is created.
html
Used to initialize Html (Parts[1]). If null or empty an ArgumentNullException is thrown.
htmlResources
Used to initialized a "multipart/related" part (Parts[1]) that provides linked embedded resources referenced by Html. If null an Htmlpart is created instead.

Exceptions

Exception | Description
System.ArgumentException | htmlResources missing reference to an HTML link.
System.ArgumentNullException | html cannot be null or empty.

Remarks

This constructor is used to create HTML email. multipart/alternative and/or multipart/related parts are created to represent the parameters provided.

If text is null or empty, then html and htmlResources are used to create either a text/html part or a mulipart/related part that contains a text/html part. Otherwise, Part.ContentType is set to "multipart/alternative" and 2 parts (text/plain, and a text/html or multipart/related) are created and saved in Parts.

If htmlResources is null, then html is represented as a single Htmlpart. Otherwise, a new "multipart/related" Multipart is created and initialized with html and linked htmlResources.

See Also

Reference

Multipart Class
Multipart Members
Overload List


Multipart Constructor(String)

[image]
PowerTCP Mail for .NET
Multipart Constructor(String)
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class > Multipart Constructor : Multipart Constructor(String)

mediaType
String used to initialize ContentType.MediaType. Typical values are available through Mixed, Alternative, and Related.

Glossary Item Box

Public constructor used for subsequent encoding.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal mediaType As String _
)
Visual Basic (Usage) Copy Code
Dim mediaType As String

Dim instance As New Multipart(mediaType)
C#
public Multipart(
   string mediaType
)
Managed Extensions for C++
public: Multipart(
   string* mediaType
)
C++/CLI
public:
Multipart(
   String^ mediaType
)

Parameters

mediaType
String used to initialize ContentType.MediaType. Typical values are available through Mixed, Alternative, and Related.

See Also

Reference

Multipart Class
Multipart Members
Overload List


Multipart Class Methods

[image]
PowerTCP Mail for .NET
Multipart Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Multipart Class

Glossary Item Box

For a list of all members of this type, see Multipart members.

Public Methods

 | Name | Description
Public Method | Clear | Overridden. Reinitializes the part to default values.
Public Method | Clone | Overridden. Creates a deep copy of the Multipart, but deep/shallow copies of its Parts. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
Public Method | FindHtml | Finds the first Htmlpart, recursively searching Parts (depth before breadth).
Public Method | FindParent | Performs a recursive search to find the "parent" Part of the specified child within this Multipart.
Public Method | FindText | Finds the first Textpart, recursively searching Parts (depth before breadth).
Public Method | GetContentEncodingStream | Overridden. Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Multipart Class
Dart.Mail Namespace


Clear Method

[image]
PowerTCP Mail for .NET
Clear Method
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Clear Method

Glossary Item Box

Reinitializes the part to default values.

Syntax

Visual Basic (Declaration)
Public Overrides Sub Clear()
Visual Basic (Usage) Copy Code
Dim instance As Multipart

instance.Clear()
C#
public override void Clear()
Managed Extensions for C++
public: void Clear(); override
C++/CLI
public:
void Clear(); override

See Also

Reference

Multipart Class
Multipart Members


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Clone Method

Glossary Item Box

Creates a deep copy of the Multipart, but deep/shallow copies of its Parts. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.

Syntax

Visual Basic (Declaration)
Public Overrides Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As Object

value = instance.Clone()
C#
public override object Clone()
Managed Extensions for C++
public: Object* Clone(); override
C++/CLI
public:
Object^ Clone(); override

Return Value

A Multipart

Remarks

Note: Calling Dispose() on the original or cloned Multipart will dispose of any shallow-copied parts that the original and clone reference.

See Also

Reference

Multipart Class
Multipart Members


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Dispose Method

Glossary Item Box

Releases all resources associated with the object.

Overload List

Overload | Description
Dispose(Boolean) | Releases all resources associated with the object.
Dispose() | Releases all resources associated with the object. (Inherited from Dart.Mail.Part)

See Also

Reference

Multipart Class
Multipart Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method releases all resources and deletes any unmoved decoded attachments.

See Also

Reference

Multipart Class
Multipart Members
Overload List


FindHtml Method

[image]
PowerTCP Mail for .NET
FindHtml Method
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : FindHtml Method

Glossary Item Box

Finds the first Htmlpart, recursively searching Parts (depth before breadth).

Syntax

Visual Basic (Declaration)
Public Function FindHtml() As Htmlpart
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As Htmlpart

value = instance.FindHtml()
C#
public Htmlpart FindHtml()
Managed Extensions for C++
public: Htmlpart* FindHtml();
C++/CLI
public:
Htmlpart^ FindHtml();

Return Value

An Htmlpart, or null if none is found.

See Also

Reference

Multipart Class
Multipart Members


FindParent Method

[image]
PowerTCP Mail for .NET
FindParent Method
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : FindParent Method

child
Part to find the parent for.

Glossary Item Box

Performs a recursive search to find the "parent" Part of the specified child within this Multipart.

Syntax

Visual Basic (Declaration)
Public Function FindParent( _
   ByVal child As Part _
) As Multipart
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim child As Part
Dim value As Multipart

value = instance.FindParent(child)
C#
public Multipart FindParent(
   Part child
)
Managed Extensions for C++
public: Multipart* FindParent(
   Part* child
)
C++/CLI
public:
Multipart^ FindParent(
   Part^ child
)

Parameters

child
Part to find the parent for.

Return Value

Multipart

See Also

Reference

Multipart Class
Multipart Members


FindText Method

[image]
PowerTCP Mail for .NET
FindText Method
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : FindText Method

Glossary Item Box

Finds the first Textpart, recursively searching Parts (depth before breadth).

Syntax

Visual Basic (Declaration)
Public Function FindText() As Textpart
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As Textpart

value = instance.FindText()
C#
public Textpart FindText()
Managed Extensions for C++
public: Textpart* FindText();
C++/CLI
public:
Textpart^ FindText();

Return Value

A Textpart, or null if none is found.

See Also

Reference

Multipart Class
Multipart Members


GetContentEncodingStream Method

[image]
PowerTCP Mail for .NET
GetContentEncodingStream Method
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : GetContentEncodingStream Method

Glossary Item Box

Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetContentEncodingStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As Stream

value = instance.GetContentEncodingStream()
C#
public override Stream GetContentEncodingStream()
Managed Extensions for C++
public: Stream* GetContentEncodingStream(); override
C++/CLI
public:
Stream^ GetContentEncodingStream(); override

Return Value

A System.IO.Stream that encodes/decodes.

Remarks

Acts on the body content only (not the Headers).

See Also

Reference

Multipart Class
Multipart Members


Multipart Class Properties

[image]
PowerTCP Mail for .NET
Multipart Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Multipart Class

Glossary Item Box

For a list of all members of this type, see Multipart members.

Public Properties

 | Name | Description
Public Property | Attachments | Get a generic List containing all the Attachments within this part and sub-parts.
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Html | Gets or sets the HTML text body.
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Parts | A Part list that contains all the parts in the Multipart.
Public Property | Resources | Get a generic List containing all the Resources within this part and sub-parts.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | Text | Gets or sets the plain text body.
Top

See Also

Reference

Multipart Class
Dart.Mail Namespace


Attachments Property

[image]
PowerTCP Mail for .NET
Attachments Property
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Attachments Property

Glossary Item Box

Get a generic List containing all the Attachments within this part and sub-parts.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Attachments As PartCollection(Of Attachment)
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As PartCollection(Of Attachment)

value = instance.Attachments
C#
public PartCollection<Attachment> Attachments {get;}
Managed Extensions for C++
public: __property PartCollection<Attachment*>* get_Attachments();
C++/CLI
public:
property PartCollection<Attachment^>^ Attachments {
   PartCollection<Attachment^>^ get();
}

See Also

Reference

Multipart Class
Multipart Members


Html Property

[image]
PowerTCP Mail for .NET
Html Property
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Html Property

Glossary Item Box

Gets or sets the HTML text body.

Syntax

Visual Basic (Declaration)
Public Property Html As String
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As String

instance.Html = value

value = instance.Html
C#
public string Html {get; set;}
Managed Extensions for C++
public: __property string* get_Html();
public: __property void set_Html(
   string* value
);
C++/CLI
public:
property String^ Html {
   String^ get();
   void set (    String^ value);
}

Property Value

A string representing the HTML text.

Remarks

When read and no "text/html" part is found, an empty string is returned. Parts are searched "depth before breadth".

When set to a non-empty string and no part is found, a new Htmlpart is created and added to Parts. If set to null or an empty string and a "text/html" part is found, the part is removed.

See Also

Reference

Multipart Class
Multipart Members


Length Property

[image]
PowerTCP Mail for .NET
Length Property
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Length Property

Glossary Item Box

Returns the approximate Length of the encoded part.

Syntax

Visual Basic (Declaration)
Public Overrides ReadOnly Property Length As Long
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As Long

value = instance.Length
C#
public override long Length {get;}
Managed Extensions for C++
public: __property long get_Length() override;
C++/CLI
public:
property int64 Length {
   int64 get() override;
}

See Also

Reference

Multipart Class
Multipart Members


Parts Property

[image]
PowerTCP Mail for .NET
Parts Property
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Parts Property

Glossary Item Box

A Part list that contains all the parts in the Multipart.

Syntax

Visual Basic (Declaration)
Public Property Parts As MultipartContent
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As MultipartContent

instance.Parts = value

value = instance.Parts
C#
public MultipartContent Parts {get; set;}
Managed Extensions for C++
public: __property MultipartContent* get_Parts();
public: __property void set_Parts(
   MultipartContent* value
);
C++/CLI
public:
property MultipartContent^ Parts {
   MultipartContent^ get();
   void set (    MultipartContent^ value);
}

See Also

Reference

Multipart Class
Multipart Members


Resources Property

[image]
PowerTCP Mail for .NET
Resources Property
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Resources Property

Glossary Item Box

Get a generic List containing all the Resources within this part and sub-parts.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Resources As PartCollection(Of Resource)
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As PartCollection(Of Resource)

value = instance.Resources
C#
public PartCollection<Resource> Resources {get;}
Managed Extensions for C++
public: __property PartCollection<Resource*>* get_Resources();
C++/CLI
public:
property PartCollection<Resource^>^ Resources {
   PartCollection<Resource^>^ get();
}

See Also

Reference

Multipart Class
Multipart Members


Text Property

[image]
PowerTCP Mail for .NET
Text Property
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Text Property

Glossary Item Box

Gets or sets the plain text body.

Syntax

Visual Basic (Declaration)
Public Property Text As String
Visual Basic (Usage) Copy Code
Dim instance As Multipart
Dim value As String

instance.Text = value

value = instance.Text
C#
public string Text {get; set;}
Managed Extensions for C++
public: __property string* get_Text();
public: __property void set_Text(
   string* value
);
C++/CLI
public:
property String^ Text {
   String^ get();
   void set (    String^ value);
}

Property Value

A string representing the plain text.

Remarks

When read and no "text/plain" part is found, an empty string is returned. Parts are searched "depth before breadth".

When set to a non-empty string and no part is found, a new Textpart is created and added to Parts. If set to null or an empty string and a "text/plain" part is found, the part is removed.

See Also

Reference

Multipart Class
Multipart Members


Multipart Class Fields

[image]
PowerTCP Mail for .NET
Multipart Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : Multipart Class

Glossary Item Box

For a list of all members of this type, see Multipart members.

Public Fields

 | Name | Description
Public Field | Alternative | String used to initialize ContentType.MediaType to "multipart/alternative".
Public Field | Mixed | String used to initialize ContentType.MediaType to "multipart/mixed".
Public Field | Related | String used to initialize ContentType.MediaType to "multipart/related".
Top

See Also

Reference

Multipart Class
Dart.Mail Namespace


Alternative Field

[image]
PowerTCP Mail for .NET
Alternative Field
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Alternative Field

Glossary Item Box

String used to initialize ContentType.MediaType to "multipart/alternative".

Syntax

Visual Basic (Declaration)
Public Const Alternative As String
Visual Basic (Usage) Copy Code
Dim value As String

value = Multipart.Alternative
C#
public const string Alternative
Managed Extensions for C++
public: const string* Alternative
C++/CLI
public:
const String^ Alternative

See Also

Reference

Multipart Class
Multipart Members


Mixed Field

[image]
PowerTCP Mail for .NET
Mixed Field
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Mixed Field

Glossary Item Box

String used to initialize ContentType.MediaType to "multipart/mixed".

Syntax

Visual Basic (Declaration)
Public Const Mixed As String
Visual Basic (Usage) Copy Code
Dim value As String

value = Multipart.Mixed
C#
public const string Mixed
Managed Extensions for C++
public: const string* Mixed
C++/CLI
public:
const String^ Mixed

See Also

Reference

Multipart Class
Multipart Members


Related Field

[image]
PowerTCP Mail for .NET
Related Field
See Also Send comments on this topic
Dart.Mail Namespace > Multipart Class : Related Field

Glossary Item Box

String used to initialize ContentType.MediaType to "multipart/related".

Syntax

Visual Basic (Declaration)
Public Const Related As String
Visual Basic (Usage) Copy Code
Dim value As String

value = Multipart.Related
C#
public const string Related
Managed Extensions for C++
public: const string* Related
C++/CLI
public:
const String^ Related

See Also

Reference

Multipart Class
Multipart Members


MultipartContent Class

[image]
PowerTCP Mail for .NET
MultipartContent Class
Members See Also Send comments on this topic
Dart.Mail Namespace : MultipartContent Class

Glossary Item Box

Multi-part content (a List of parts) that follows the header.

Object Model

MultipartContent ClassPart Class

Syntax

Visual Basic (Declaration)
Public Class MultipartContent
   Inherits System.Collections.Generic.List(Of Part)
Visual Basic (Usage) Copy Code
Dim instance As MultipartContent
C#
public class MultipartContent : System.Collections.Generic.List<Part>
Managed Extensions for C++
public __gc class MultipartContent : public System.Collections.Generic.List<Part>
C++/CLI
public ref class MultipartContent : public System.Collections.Generic.List<Part>

Remarks

All content is decoded into a sequence of parts. Each part is represented as an instance of a class: 1. Attachment (derived from Resource). Content-disposition is "attachment". 2. Textpart (derived from Resource). Content-Type media type "text/plain". 3. Htmlpart (derived from Textpart). Content-Type media type "text/html". 4. Resource (derived from Part). Not a Textpart or Attachment. 5. Multipart (derived from Part). Content-Type media type is "multipart/*".

Inheritance Hierarchy

System.Object
System.Collections.Generic.List<T>
Dart.Mail.MultipartContent

See Also

Reference

MultipartContent Members
Dart.Mail Namespace


MultipartContent Class Members

[image]
PowerTCP Mail for .NET
MultipartContent Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : MultipartContent Class

Glossary Item Box

The following tables list the members exposed by MultipartContent.

Public Constructors

 | Name | Description
Public Constructor | MultipartContent Constructor | Creates multi-part content containing no parts.
Top

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<Part>)
Public Property | Count | (Inherited from System.Collections.Generic.List<Part>)
Public Property | Item | (Inherited from System.Collections.Generic.List<Part>)
Public Property | Text | Returns a decoded representation of the non-mime content.
Top

Public Methods

 | Name | Description
Public Method | Add | (Inherited from System.Collections.Generic.List<Part>)
Public Method | AddRange | (Inherited from System.Collections.Generic.List<Part>)
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<Part>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Clear | (Inherited from System.Collections.Generic.List<Part>)
Public Method | Clone | Creates a deep copy of the MultipartContent, but deep/shallow copies of each Part. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.
Public Method | Contains | (Inherited from System.Collections.Generic.List<Part>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<Part>)
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Exists | (Inherited from System.Collections.Generic.List<Part>)
Public Method | Filter | Returns a ReadOnlyCollection that contains only parts that are or are derived from the specified type.
Public Method | Find | (Inherited from System.Collections.Generic.List<Part>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<Part>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<Part>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<Part>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<Part>)
Public Method | GetRange | (Inherited from System.Collections.Generic.List<Part>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Insert | (Inherited from System.Collections.Generic.List<Part>)
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<Part>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Remove | (Inherited from System.Collections.Generic.List<Part>)
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<Part>)
Public Method | RemoveAt | (Inherited from System.Collections.Generic.List<Part>)
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<Part>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | ToArray | (Inherited from System.Collections.Generic.List<Part>)
Public Method | ToString | Overloaded. Returns a decoded representation of all the Parts (including headers) that is suitable for display.
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<Part>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<Part>)
Top

See Also

Reference

MultipartContent Class
Dart.Mail Namespace


MultipartContent Constructor

[image]
PowerTCP Mail for .NET
MultipartContent Constructor
See Also Send comments on this topic
Dart.Mail Namespace > MultipartContent Class : MultipartContent Constructor

Glossary Item Box

Creates multi-part content containing no parts.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New MultipartContent()
C#
public MultipartContent()
Managed Extensions for C++
public: MultipartContent();
C++/CLI
public:
MultipartContent();

See Also

Reference

MultipartContent Class
MultipartContent Members


MultipartContent Class Methods

[image]
PowerTCP Mail for .NET
MultipartContent Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : MultipartContent Class

Glossary Item Box

For a list of all members of this type, see MultipartContent members.

Public Methods

 | Name | Description
Public Method | Add | (Inherited from System.Collections.Generic.List<Part>)
Public Method | AddRange | (Inherited from System.Collections.Generic.List<Part>)
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<Part>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Clear | (Inherited from System.Collections.Generic.List<Part>)
Public Method | Clone | Creates a deep copy of the MultipartContent, but deep/shallow copies of each Part. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.
Public Method | Contains | (Inherited from System.Collections.Generic.List<Part>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<Part>)
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Exists | (Inherited from System.Collections.Generic.List<Part>)
Public Method | Filter | Returns a ReadOnlyCollection that contains only parts that are or are derived from the specified type.
Public Method | Find | (Inherited from System.Collections.Generic.List<Part>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<Part>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<Part>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<Part>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<Part>)
Public Method | GetRange | (Inherited from System.Collections.Generic.List<Part>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Insert | (Inherited from System.Collections.Generic.List<Part>)
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<Part>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Remove | (Inherited from System.Collections.Generic.List<Part>)
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<Part>)
Public Method | RemoveAt | (Inherited from System.Collections.Generic.List<Part>)
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<Part>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<Part>)
Public Method | ToArray | (Inherited from System.Collections.Generic.List<Part>)
Public Method | ToString | Overloaded. Returns a decoded representation of all the Parts (including headers) that is suitable for display.
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<Part>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<Part>)
Top

See Also

Reference

MultipartContent Class
Dart.Mail Namespace


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > MultipartContent Class : Clone Method

Glossary Item Box

Creates a deep copy of the MultipartContent, but deep/shallow copies of each Part. Attachments and Resources are shallow copies, Textparts and Htmlparts are deep copies.

Syntax

Visual Basic (Declaration)
Public Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As MultipartContent
Dim value As Object

value = instance.Clone()
C#
public object Clone()
Managed Extensions for C++
public: Object* Clone();
C++/CLI
public:
Object^ Clone();

Return Value

A MultipartContent

Remarks

Note: Calling Dispose() on the original or cloned MultipartContent will dispose of any shallow-copied parts that the original and clone reference.

See Also

Reference

MultipartContent Class
MultipartContent Members


Filter Method

[image]
PowerTCP Mail for .NET
Filter Method
See Also Send comments on this topic
Dart.Mail Namespace > MultipartContent Class : Filter Method

type
Type to filter on.
recurse
If true, searches embedded parts; otherwise only the parts at this level are searched.
includeSubClasses
If true, subclasses are included.

Glossary Item Box

Returns a ReadOnlyCollection that contains only parts that are or are derived from the specified type.

Syntax

Visual Basic (Declaration)
Public Function Filter( _
   ByVal type As Type, _
   ByVal recurse As Boolean, _
   ByVal includeSubClasses As Boolean _
) As ReadOnlyCollection(Of Part)
Visual Basic (Usage) Copy Code
Dim instance As MultipartContent
Dim type As Type
Dim recurse As Boolean
Dim includeSubClasses As Boolean
Dim value As ReadOnlyCollection(Of Part)

value = instance.Filter(type, recurse, includeSubClasses)
C#
public ReadOnlyCollection<Part> Filter(
   Type type,
   bool recurse,
   bool includeSubClasses
)
Managed Extensions for C++
public: ReadOnlyCollection<Part*>* Filter(
   Type* type,
   bool recurse,
   bool includeSubClasses
)
C++/CLI
public:
ReadOnlyCollection<Part^>^ Filter(
   Type^ type,
   bool recurse,
   bool includeSubClasses
)

Parameters

type
Type to filter on.
recurse
If true, searches embedded parts; otherwise only the parts at this level are searched.
includeSubClasses
If true, subclasses are included.

Return Value

A ReadOnlyCollection containing parts that are or are derived from the specified type.

See Also

Reference

MultipartContent Class
MultipartContent Members


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > MultipartContent Class : ToString Method

Glossary Item Box

Returns a decoded representation of all the Parts (including headers) that is suitable for display.

Overload List

Overload | Description
ToString(Boolean,MailMessage) | Returns a decoded representation of all the Parts (including headers) that is suitable for display.

See Also

Reference

MultipartContent Class
MultipartContent Members


ToString(Boolean,MailMessage) Method

[image]
PowerTCP Mail for .NET
ToString(Boolean,MailMessage) Method
See Also Send comments on this topic
Dart.Mail Namespace > MultipartContent Class > ToString Method : ToString(Boolean,MailMessage) Method

includeHeaders
true if part headers should be included. Otherwise only the content body is returned.
baseMessage
The base MailMessage that is used to compute the part level for the returned String. Can be null.

Glossary Item Box

Returns a decoded representation of all the Parts (including headers) that is suitable for display.

Syntax

Visual Basic (Declaration)
Public Overloads Function ToString( _
   ByVal includeHeaders As Boolean, _
   ByVal baseMessage As MailMessage _
) As String
Visual Basic (Usage) Copy Code
Dim instance As MultipartContent
Dim includeHeaders As Boolean
Dim baseMessage As MailMessage
Dim value As String

value = instance.ToString(includeHeaders, baseMessage)
C#
public string ToString(
   bool includeHeaders,
   MailMessage baseMessage
)
Managed Extensions for C++
public: string* ToString(
   bool includeHeaders,
   MailMessage* baseMessage
)
C++/CLI
public:
String^ ToString(
   bool includeHeaders,
   MailMessage^ baseMessage
)

Parameters

includeHeaders
true if part headers should be included. Otherwise only the content body is returned.
baseMessage
The base MailMessage that is used to compute the part level for the returned String. Can be null.

See Also

Reference

MultipartContent Class
MultipartContent Members
Overload List


MultipartContent Class Properties

[image]
PowerTCP Mail for .NET
MultipartContent Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : MultipartContent Class

Glossary Item Box

For a list of all members of this type, see MultipartContent members.

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<Part>)
Public Property | Count | (Inherited from System.Collections.Generic.List<Part>)
Public Property | Item | (Inherited from System.Collections.Generic.List<Part>)
Public Property | Text | Returns a decoded representation of the non-mime content.
Top

See Also

Reference

MultipartContent Class
Dart.Mail Namespace


Text Property

[image]
PowerTCP Mail for .NET
Text Property
See Also Send comments on this topic
Dart.Mail Namespace > MultipartContent Class : Text Property

Glossary Item Box

Returns a decoded representation of the non-mime content.

Syntax

Visual Basic (Declaration)
Public Property Text As String
Visual Basic (Usage) Copy Code
Dim instance As MultipartContent
Dim value As String

instance.Text = value

value = instance.Text
C#
public string Text {get; set;}
Managed Extensions for C++
public: __property string* get_Text();
public: __property void set_Text(
   string* value
);
C++/CLI
public:
property String^ Text {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

MultipartContent Class
MultipartContent Members


Part Class

[image]
PowerTCP Mail for .NET
Part Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Part Class

Glossary Item Box

Implements base functionality for all mail classes that have a header and a body.

Object Model

Part ClassContentType ClassHeaderDictionary ClassHeaderField Class

Syntax

Visual Basic (Declaration)
Public MustInherit Class Part
Visual Basic (Usage) Copy Code
Dim instance As Part
C#
public abstract class Part
Managed Extensions for C++
public __gc abstract class Part
C++/CLI
public ref class Part abstract

Inheritance Hierarchy

System.Object
Dart.Mail.Part
Dart.Mail.Multipart
Dart.Mail.Resource

See Also

Reference

Part Members
Dart.Mail Namespace


Part Class Members

[image]
PowerTCP Mail for .NET
Part Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : Part Class

Glossary Item Box

The following tables list the members exposed by Part.

Public Properties

 | Name | Description
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part.
static (Shared in Visual Basic) | EncodingMap | Gets a Dictionary that is used to map an invalid ContentType.CharSet to a valid replacement System.Text.Encoding.
Public Property | Headers | Provides a Headers instance that lists all unique header fields.
Public Property | Length | Returns the approximate Length of the encoded part in all derived classes.
Public Property | Tag | Gets or sets an object that stores any user data.
Top

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values.
Public Method | Clone | Creates a deep copy of the Part, but a shallow copy of its content.
Public Method | Dispose | Overloaded. Releases all resources associated with the object.
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding.
static (Shared in Visual Basic) | GetEncoding | Gets the named encoding using System.Text.Encoding.GetEncoding(System.String) and EncodingMap, which allows invalid character sets to be mapped to valid ones.
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.
Public Method | ToArray | Returns the encoded MIME entity as a byte array.
Public Method | ToString | Overloaded. Returns the MIME entity as a String.
Top

See Also

Reference

Part Class
Dart.Mail Namespace


Part Class Methods

[image]
PowerTCP Mail for .NET
Part Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Part Class

Glossary Item Box

For a list of all members of this type, see Part members.

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values.
Public Method | Clone | Creates a deep copy of the Part, but a shallow copy of its content.
Public Method | Dispose | Overloaded. Releases all resources associated with the object.
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding.
static (Shared in Visual Basic) | GetEncoding | Gets the named encoding using System.Text.Encoding.GetEncoding(System.String) and EncodingMap, which allows invalid character sets to be mapped to valid ones.
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.
Public Method | ToArray | Returns the encoded MIME entity as a byte array.
Public Method | ToString | Overloaded. Returns the MIME entity as a String.
Top

See Also

Reference

Part Class
Dart.Mail Namespace


Clear Method

[image]
PowerTCP Mail for .NET
Clear Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : Clear Method

Glossary Item Box

Reinitializes the part to default (empty) values.

Syntax

Visual Basic (Declaration)
Public Overridable Sub Clear()
Visual Basic (Usage) Copy Code
Dim instance As Part

instance.Clear()
C#
public virtual void Clear()
Managed Extensions for C++
public: virtual void Clear();
C++/CLI
public:
virtual void Clear();

See Also

Reference

Part Class
Part Members


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : Clone Method

Glossary Item Box

Creates a deep copy of the Part, but a shallow copy of its content.

Syntax

Visual Basic (Declaration)
Public MustOverride Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim value As Object

value = instance.Clone()
C#
public abstract object Clone()
Managed Extensions for C++
public: abstract Object* Clone();
C++/CLI
public:
abstract Object^ Clone();

Return Value

A Part

Remarks

Note: Calling Dispose() on the original or cloned part will dispose of the data that the original and clone reference.

See Also

Reference

Part Class
Part Members


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : Dispose Method

Glossary Item Box

Releases all resources associated with the object.

Overload List

Overload | Description
Dispose() | Releases all resources associated with the object.
Dispose(Boolean) | Releases all resources associated with the object.

See Also

Reference

Part Class
Part Members


Dispose() Method

[image]
PowerTCP Mail for .NET
Dispose() Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class > Dispose Method : Dispose() Method

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Dispose()
Visual Basic (Usage) Copy Code
Dim instance As Part

instance.Dispose()
C#
public void Dispose()
Managed Extensions for C++
public: void Dispose();
C++/CLI
public:
void Dispose();

See Also

Reference

Part Class
Part Members
Overload List


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Protected Overloads Overridable Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected virtual void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: virtual void Dispose(
   bool disposing
)
C++/CLI
protected:
virtual void Dispose(
   bool disposing
)

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

See Also

Reference

Part Class
Part Members
Overload List


GetContentEncodingStream Method

[image]
PowerTCP Mail for .NET
GetContentEncodingStream Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : GetContentEncodingStream Method

Glossary Item Box

Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.

Syntax

Visual Basic (Declaration)
Public MustOverride Function GetContentEncodingStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim value As Stream

value = instance.GetContentEncodingStream()
C#
public abstract Stream GetContentEncodingStream()
Managed Extensions for C++
public: abstract Stream* GetContentEncodingStream();
C++/CLI
public:
abstract Stream^ GetContentEncodingStream();

Return Value

A System.IO.Stream that encodes/decodes.

Remarks

Acts on the body content only (not the Headers).

See Also

Reference

Part Class
Part Members


GetDecodingExceptions Method

[image]
PowerTCP Mail for .NET
GetDecodingExceptions Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : GetDecodingExceptions Method

recurse
If true, Exceptions from all subparts are returned. If false, only Exceptions created by this part are returned.

Glossary Item Box

Returns Exceptions created during decoding.

Syntax

Visual Basic (Declaration)
Public Function GetDecodingExceptions( _
   ByVal recurse As Boolean _
) As Exception()
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim recurse As Boolean
Dim value() As Exception

value = instance.GetDecodingExceptions(recurse)
C#
public Exception[] GetDecodingExceptions(
   bool recurse
)
Managed Extensions for C++
public: Exception*[]* GetDecodingExceptions(
   bool recurse
)
C++/CLI
public:
array<Exception^>^ GetDecodingExceptions(
   bool recurse
)

Parameters

recurse
If true, Exceptions from all subparts are returned. If false, only Exceptions created by this part are returned.

See Also

Reference

Part Class
Part Members


GetEncoding Method

[image]
PowerTCP Mail for .NET
GetEncoding Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : GetEncoding Method

name
The character set name.

Glossary Item Box

Gets the named encoding using System.Text.Encoding.GetEncoding(System.String) and EncodingMap, which allows invalid character sets to be mapped to valid ones.

Syntax

Visual Basic (Declaration)
Public Shared Function GetEncoding( _
   ByVal name As String _
) As Encoding
Visual Basic (Usage) Copy Code
Dim name As String
Dim value As Encoding

value = Part.GetEncoding(name)
C#
public static Encoding GetEncoding(
   string name
)
Managed Extensions for C++
public: static Encoding* GetEncoding(
   string* name
)
C++/CLI
public:
static Encoding^ GetEncoding(
   String^ name
)

Parameters

name
The character set name.

Return Value

System.Text.Encoding

Exceptions

Exception | Description
System.ArgumentException | The named encoding is invalid. Use EncodingMap to substitute a replacement encoding.

See Also

Reference

Part Class
Part Members


GetEncodingStream() Method

[image]
PowerTCP Mail for .NET
GetEncodingStream() Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : GetEncodingStream() Method

Glossary Item Box

Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.

Syntax

Visual Basic (Declaration)
Public Function GetEncodingStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim value As Stream

value = instance.GetEncodingStream()
C#
public Stream GetEncodingStream()
Managed Extensions for C++
public: Stream* GetEncodingStream();
C++/CLI
public:
Stream^ GetEncodingStream();

Return Value

A System.IO.Stream that encodes/decodes.

Remarks

Acts on the Headers and body/part content. The architecture used for all mail encoding/decoding is based on this technique where the returned Stream is simply read from or written to. All encoding and decoding happens "on-the-fly" with minimal buffering occurring in memory.

Any existing content is disposed of when a new message is decoded (when Stream.Write() is used).

See Also

Reference

Part Class
Part Members


ToArray Method

[image]
PowerTCP Mail for .NET
ToArray Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : ToArray Method

includeHeaders
true if Headers should be included. Otherwise only the content body is returned.

Glossary Item Box

Returns the encoded MIME entity as a byte array.

Syntax

Visual Basic (Declaration)
Public Function ToArray( _
   ByVal includeHeaders As Boolean _
) As Byte()
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim includeHeaders As Boolean
Dim value() As Byte

value = instance.ToArray(includeHeaders)
C#
public byte[] ToArray(
   bool includeHeaders
)
Managed Extensions for C++
public: byte[]* ToArray(
   bool includeHeaders
)
C++/CLI
public:
array<byte>^ ToArray(
   bool includeHeaders
)

Parameters

includeHeaders
true if Headers should be included. Otherwise only the content body is returned.

Return Value

byte[]

See Also

Reference

Part Class
Part Members


ToString Method

[image]
PowerTCP Mail for .NET
ToString Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : ToString Method

Glossary Item Box

Returns the MIME entity as a String.

Overload List

Overload | Description
ToString(Boolean,Boolean,MailMessage) | Returns the MIME entity as a String.

See Also

Reference

Part Class
Part Members


ToString(Boolean,Boolean,MailMessage) Method

[image]
PowerTCP Mail for .NET
ToString(Boolean,Boolean,MailMessage) Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class > ToString Method : ToString(Boolean,Boolean,MailMessage) Method

encode
true if the ASCII-encoded representation should be returned. Otherwise a decoded UNICODE representation suitable for display is returned.
includeHeaders
true if Headers should be included. Otherwise only the content body is returned.
baseMessage
The base MailMessage that is used to compute the part level for the returned String. Can be null.

Glossary Item Box

Returns the MIME entity as a String.

Syntax

Visual Basic (Declaration)
Public Overloads Function ToString( _
   ByVal encode As Boolean, _
   ByVal includeHeaders As Boolean, _
   ByVal baseMessage As MailMessage _
) As String
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim encode As Boolean
Dim includeHeaders As Boolean
Dim baseMessage As MailMessage
Dim value As String

value = instance.ToString(encode, includeHeaders, baseMessage)
C#
public string ToString(
   bool encode,
   bool includeHeaders,
   MailMessage baseMessage
)
Managed Extensions for C++
public: string* ToString(
   bool encode,
   bool includeHeaders,
   MailMessage* baseMessage
)
C++/CLI
public:
String^ ToString(
   bool encode,
   bool includeHeaders,
   MailMessage^ baseMessage
)

Parameters

encode
true if the ASCII-encoded representation should be returned. Otherwise a decoded UNICODE representation suitable for display is returned.
includeHeaders
true if Headers should be included. Otherwise only the content body is returned.
baseMessage
The base MailMessage that is used to compute the part level for the returned String. Can be null.

Return Value

String

See Also

Reference

Part Class
Part Members
Overload List


Part Class Properties

[image]
PowerTCP Mail for .NET
Part Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Part Class

Glossary Item Box

For a list of all members of this type, see Part members.

Public Properties

 | Name | Description
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part.
static (Shared in Visual Basic) | EncodingMap | Gets a Dictionary that is used to map an invalid ContentType.CharSet to a valid replacement System.Text.Encoding.
Public Property | Headers | Provides a Headers instance that lists all unique header fields.
Public Property | Length | Returns the approximate Length of the encoded part in all derived classes.
Public Property | Tag | Gets or sets an object that stores any user data.
Top

See Also

Reference

Part Class
Dart.Mail Namespace


ContentType Property

[image]
PowerTCP Mail for .NET
ContentType Property
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : ContentType Property

Glossary Item Box

Gets or sets the "Content-Type" header field for the part.

Syntax

Visual Basic (Declaration)
Public Property ContentType As ContentType
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim value As ContentType

instance.ContentType = value

value = instance.ContentType
C#
public ContentType ContentType {get; set;}
Managed Extensions for C++
public: __property ContentType* get_ContentType();
public: __property void set_ContentType(
   ContentType* value
);
C++/CLI
public:
property ContentType^ ContentType {
   ContentType^ get();
   void set (    ContentType^ value);
}

Property Value

Represents the Content-Type header line of the message or part.

Remarks

The "Content-Type" header field informs us of the type of data contained within the MIME part. For example, if ContentType.MediaType is "text/plain", during decoding we create a Textpart with Content exposing the decoded content as a string.

A null value indicates this header field is not present.

See Also

Reference

Part Class
Part Members


EncodingMap Property

[image]
PowerTCP Mail for .NET
EncodingMap Property
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : EncodingMap Property

Glossary Item Box

Gets a Dictionary that is used to map an invalid ContentType.CharSet to a valid replacement System.Text.Encoding.

Syntax

Visual Basic (Declaration)
Public Shared ReadOnly Property EncodingMap As Dictionary(Of String,Encoding)
Visual Basic (Usage) Copy Code
Dim value As Dictionary(Of String,Encoding)

value = Part.EncodingMap
C#
public static Dictionary<string,Encoding> EncodingMap {get;}
Managed Extensions for C++
public: __property static Dictionary<string*,Encoding*>* get_EncodingMap();
C++/CLI
public:
static property Dictionary<String^,Encoding^>^ EncodingMap {
   Dictionary<String^,Encoding^>^ get();
}

Remarks

If a decoded charset string doesn't map to a valid System.Text.Encoding.WebName, the charset is converted to lowercase with non-alphanumerics removed and mapped to these replacement Encodings. The default mapping is initialized as follows:
  • "headers" ---> Encoding.ASCII (used for decoding headers that were incorrectly encoded using a multibyte encoding)
  • "default" ---> Encoding.Default (the default encoding to use; also used to decode unrecognized charset strings and to initialize HeaderDictionary.Encoding in Japan)
  • "usascii" ---> Encoding.ASCII
  • "iso88591" ---> Encoding("iso-8859-1")
  • "shiftjis" ---> Encoding("shift_jis")
  • "eucjp" ---> Encoding("euc-jp")
  • "utf7" ---> Encoding.UTF7
  • "utf8" ---> Encoding.UTF8
  • "cp932" ---> Encoding("shift_jis")
  • "windows31j" ---> Encoding("shift_jis")
  • "cp1252" ---> Encoding("windows-1252")
  • "windows1252httpequivcontenttype" ---> Encoding("windows-1252")
Use 'Part.EncodingMap.Add("invalid-charset", Encoding.GetEncoding(/*replacement name or codepage*/))' to map any charset value to a replacement encoding.

See Also

Reference

Part Class
Part Members


Headers Property

[image]
PowerTCP Mail for .NET
Headers Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Part Class : Headers Property

Glossary Item Box

Provides a Headers instance that lists all unique header fields.

Syntax

Visual Basic (Declaration)
Public Property Headers As HeaderDictionary
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim value As HeaderDictionary

instance.Headers = value

value = instance.Headers
C#
public HeaderDictionary Headers {get; set;}
Managed Extensions for C++
public: __property HeaderDictionary* get_Headers();
public: __property void set_Headers(
   HeaderDictionary* value
);
C++/CLI
public:
property HeaderDictionary^ Headers {
   HeaderDictionary^ get();
   void set (    HeaderDictionary^ value);
}

Remarks

Any duplicate header field names found during decoding are stored in Duplicates. They are subsequently reused during encoding of the Header.

Example

This example demonstrates how to add a custom header field to a message.
C# Copy Code
private MailMessage addCustomHeaderField(MailMessage message)
{
    //Add the following header to the message:
    //My-Custom-Header: This is a custom header
    message.Headers.Add("My-Custom-Header", new HeaderField("My-Custom-Header", "This is a custom header"));
    return message;
}
Visual Basic Copy Code
Private Function addCustomHeaderField(ByVal message As MailMessage) As MailMessage
    'Add the following header to the message:
    'My-Custom-Header: This is a custom header
    message.Headers.Add("My-Custom-Header", New HeaderField("My-Custom-Header", "This is a custom header"))
    Return message
End Function

See Also

Reference

Part Class
Part Members


Length Property

[image]
PowerTCP Mail for .NET
Length Property
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : Length Property

Glossary Item Box

Returns the approximate Length of the encoded part in all derived classes.

Syntax

Visual Basic (Declaration)
Public MustOverride ReadOnly Property Length As Long
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim value As Long

value = instance.Length
C#
public abstract long Length {get;}
Managed Extensions for C++
public: __property abstract long get_Length();
C++/CLI
public:
abstract property int64 Length {
   int64 get();
}

See Also

Reference

Part Class
Part Members


Tag Property

[image]
PowerTCP Mail for .NET
Tag Property
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : Tag Property

Glossary Item Box

Gets or sets an object that stores any user data.

Syntax

Visual Basic (Declaration)
Public Property Tag As Object
Visual Basic (Usage) Copy Code
Dim instance As Part
Dim value As Object

instance.Tag = value

value = instance.Tag
C#
public object Tag {get; set;}
Managed Extensions for C++
public: __property Object* get_Tag();
public: __property void set_Tag(
   Object* value
);
C++/CLI
public:
property Object^ Tag {
   Object^ get();
   void set (    Object^ value);
}

See Also

Reference

Part Class
Part Members


PartCollection<T> Class

T
[image]
PowerTCP Mail for .NET
PartCollection<T> Class
Members See Also Send comments on this topic
Dart.Mail Namespace : PartCollection<T> Class

Glossary Item Box

Base class that implements a generic List that operates on Multipart.Parts.

Object Model

PartCollection<T> Class

Syntax

Visual Basic (Declaration)
Public Class PartCollection(Of T As Resource)
   Inherits System.Collections.Generic.List(Of T)
Visual Basic (Usage) Copy Code
Dim instance As PartCollection(Of T)
C#
public class PartCollection<T> : System.Collections.Generic.List<T>
where T: Resource
Managed Extensions for C++
public __gc class PartCollection<T> : public System.Collections.Generic.List<T>
where T: Resource
C++/CLI
generic<typename T>
public ref class PartCollection : public System.Collections.Generic.List<T>
where T: Resource

Type Parameters

T

Inheritance Hierarchy

System.Object
System.Collections.Generic.List<T>
Dart.Mail.PartCollection<T>

See Also

Reference

PartCollection<T> Members
Dart.Mail Namespace


PartCollection<T> Class Members

[image]
PowerTCP Mail for .NET
PartCollection<T> Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : PartCollection<T> Class

Glossary Item Box

The following tables list the members exposed by PartCollection<T>.

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<T>)
Public Property | Count | (Inherited from System.Collections.Generic.List<T>)
Public Property | Item | (Inherited from System.Collections.Generic.List<T>)
Top

Public Methods

 | Name | Description
Public Method | Add | Adds the specified part to Parts.
Public Method | AddRange | Add the specified parts to Parts.
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<T>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | Clear | (Inherited from System.Collections.Generic.List<T>)
Public Method | Contains | (Inherited from System.Collections.Generic.List<T>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<T>)
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | Exists | (Inherited from System.Collections.Generic.List<T>)
Public Method | Find | (Inherited from System.Collections.Generic.List<T>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<T>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<T>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<T>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<T>)
Public Method | GetRange | (Inherited from System.Collections.Generic.List<T>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<T>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | Remove | Removes the specified part from the message.
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<T>)
Public Method | RemoveAt | Removes the specified attachment from the owning Multipart.
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<T>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | ToArray | (Inherited from System.Collections.Generic.List<T>)
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<T>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<T>)
Top

See Also

Reference

PartCollection<T> Class
Dart.Mail Namespace


PartCollection<T> Class Methods

[image]
PowerTCP Mail for .NET
PartCollection<T> Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : PartCollection<T> Class

Glossary Item Box

For a list of all members of this type, see PartCollection<T> members.

Public Methods

 | Name | Description
Public Method | Add | Adds the specified part to Parts.
Public Method | AddRange | Add the specified parts to Parts.
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<T>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | Clear | (Inherited from System.Collections.Generic.List<T>)
Public Method | Contains | (Inherited from System.Collections.Generic.List<T>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<T>)
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | Exists | (Inherited from System.Collections.Generic.List<T>)
Public Method | Find | (Inherited from System.Collections.Generic.List<T>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<T>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<T>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<T>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<T>)
Public Method | GetRange | (Inherited from System.Collections.Generic.List<T>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<T>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | Remove | Removes the specified part from the message.
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<T>)
Public Method | RemoveAt | Removes the specified attachment from the owning Multipart.
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<T>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<T>)
Public Method | ToArray | (Inherited from System.Collections.Generic.List<T>)
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<T>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<T>)
Top

See Also

Reference

PartCollection<T> Class
Dart.Mail Namespace


Add Method

[image]
PowerTCP Mail for .NET
Add Method
See Also Send comments on this topic
Dart.Mail Namespace > PartCollection<T> Class : Add Method

part
The Resource to add to the Multipart.

Glossary Item Box

Adds the specified part to Parts.

Syntax

Visual Basic (Declaration)
Public Shadows Sub Add( _
   ByVal part As T _
)
Visual Basic (Usage) Copy Code
Dim instance As PartCollection(Of T)
Dim part As T

instance.Add(part)
C#
public new void Add(
   T part
)
Managed Extensions for C++
public: new void Add(
   T* part
)
C++/CLI
public:
new void Add(
   T^ part
)

Parameters

part
The Resource to add to the Multipart.

See Also

Reference

PartCollection<T> Class
PartCollection<T> Members


AddRange Method

[image]
PowerTCP Mail for .NET
AddRange Method
See Also Send comments on this topic
Dart.Mail Namespace > PartCollection<T> Class : AddRange Method

collection

Glossary Item Box

Add the specified parts to Parts.

Syntax

Visual Basic (Declaration)
Public Shadows Sub AddRange( _
   ByVal collection As IEnumerable(Of T) _
)
Visual Basic (Usage) Copy Code
Dim instance As PartCollection(Of T)
Dim collection As IEnumerable(Of T)

instance.AddRange(collection)
C#
public new void AddRange(
   IEnumerable<T> collection
)
Managed Extensions for C++
public: new void AddRange(
   IEnumerable<T*>* collection
)
C++/CLI
public:
new void AddRange(
   IEnumerable<T^>^ collection
)

Parameters

collection

See Also

Reference

PartCollection<T> Class
PartCollection<T> Members


Remove(T) Method

[image]
PowerTCP Mail for .NET
Remove(T) Method
See Also Send comments on this topic
Dart.Mail Namespace > PartCollection<T> Class : Remove(T) Method

part
The Resource to remove from the Multipart.

Glossary Item Box

Removes the specified part from the message.

Syntax

Visual Basic (Declaration)
Public Shadows Function Remove( _
   ByVal part As T _
) As Boolean
Visual Basic (Usage) Copy Code
Dim instance As PartCollection(Of T)
Dim part As T
Dim value As Boolean

value = instance.Remove(part)
C#
public new bool Remove(
   T part
)
Managed Extensions for C++
public: new bool Remove(
   T* part
)
C++/CLI
public:
new bool Remove(
   T^ part
)

Parameters

part
The Resource to remove from the Multipart.

See Also

Reference

PartCollection<T> Class
PartCollection<T> Members


RemoveAt Method

[image]
PowerTCP Mail for .NET
RemoveAt Method
See Also Send comments on this topic
Dart.Mail Namespace > PartCollection<T> Class : RemoveAt Method

index
The index of the Parts to remove.

Glossary Item Box

Removes the specified attachment from the owning Multipart.

Syntax

Visual Basic (Declaration)
Public Shadows Sub RemoveAt( _
   ByVal index As Integer _
)
Visual Basic (Usage) Copy Code
Dim instance As PartCollection(Of T)
Dim index As Integer

instance.RemoveAt(index)
C#
public new void RemoveAt(
   int index
)
Managed Extensions for C++
public: new void RemoveAt(
   int index
)
C++/CLI
public:
new void RemoveAt(
   int index
)

Parameters

index
The index of the Parts to remove.

See Also

Reference

PartCollection<T> Class
PartCollection<T> Members


PipelineSendException Class

[image]
PowerTCP Mail for .NET
PipelineSendException Class
Members See Also Send comments on this topic
Dart.Mail Namespace : PipelineSendException Class

Glossary Item Box

Thrown when a message fails to be sent using the SMTP Pipelining extension.

Object Model

PipelineSendException Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class PipelineSendException
   Inherits System.ApplicationException
Visual Basic (Usage) Copy Code
Dim instance As PipelineSendException
C#
[Serializable()]
public class PipelineSendException : System.ApplicationException
Managed Extensions for C++
[Serializable()]
public __gc class PipelineSendException : public System.ApplicationException
C++/CLI
[Serializable()]
public ref class PipelineSendException : public System.ApplicationException

Remarks

This exception is thrown when a message failes to be sent using the SMTP Pipelining extension. The RecipientReport property contains information regarding the status of each recipient listed in the email message and can be examined for recipient failures.

Inheritance Hierarchy

System.Object
System.Exception
System.ApplicationException
Dart.Mail.PipelineSendException

See Also

Reference

PipelineSendException Members
Dart.Mail Namespace


PipelineSendException Class Members

[image]
PowerTCP Mail for .NET
PipelineSendException Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : PipelineSendException Class

Glossary Item Box

The following tables list the members exposed by PipelineSendException.

Public Properties

 | Name | Description
Public Property | Data | (Inherited from System.Exception)
Public Property | HelpLink | (Inherited from System.Exception)
Public Property | HResult | (Inherited from System.Exception)
Public Property | InnerException | (Inherited from System.Exception)
Public Property | Message | (Inherited from System.Exception)
Public Property | RecipientReport | A collection of Recipient objects which associates each recipient's System.Net.Mail.MailAddress with the response received from the server when the address was submitted.
Public Property | Source | (Inherited from System.Exception)
Public Property | StackTrace | (Inherited from System.Exception)
Public Property | TargetSite | (Inherited from System.Exception)
Top

Public Methods

 | Name | Description
Public Method | GetBaseException | (Inherited from System.Exception)
Public Method | GetObjectData | (Inherited from System.Exception)
Public Method | GetType | (Inherited from System.Exception)
Public Method | ToString | (Inherited from System.Exception)
Top

Protected Events

 | Name | Description
Protected Event | SerializeObjectState | (Inherited from System.Exception)
Top

See Also

Reference

PipelineSendException Class
Dart.Mail Namespace


PipelineSendException Class Properties

[image]
PowerTCP Mail for .NET
PipelineSendException Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : PipelineSendException Class

Glossary Item Box

For a list of all members of this type, see PipelineSendException members.

Public Properties

 | Name | Description
Public Property | Data | (Inherited from System.Exception)
Public Property | HelpLink | (Inherited from System.Exception)
Public Property | HResult | (Inherited from System.Exception)
Public Property | InnerException | (Inherited from System.Exception)
Public Property | Message | (Inherited from System.Exception)
Public Property | RecipientReport | A collection of Recipient objects which associates each recipient's System.Net.Mail.MailAddress with the response received from the server when the address was submitted.
Public Property | Source | (Inherited from System.Exception)
Public Property | StackTrace | (Inherited from System.Exception)
Public Property | TargetSite | (Inherited from System.Exception)
Top

See Also

Reference

PipelineSendException Class
Dart.Mail Namespace


RecipientReport Property

[image]
PowerTCP Mail for .NET
RecipientReport Property
See Also Send comments on this topic
Dart.Mail Namespace > PipelineSendException Class : RecipientReport Property

Glossary Item Box

A collection of Recipient objects which associates each recipient's System.Net.Mail.MailAddress with the response received from the server when the address was submitted.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property RecipientReport As List(Of Recipient)
Visual Basic (Usage) Copy Code
Dim instance As PipelineSendException
Dim value As List(Of Recipient)

value = instance.RecipientReport
C#
public List<Recipient> RecipientReport {get;}
Managed Extensions for C++
public: __property List<Recipient*>* get_RecipientReport();
C++/CLI
public:
property List<Recipient^>^ RecipientReport {
   List<Recipient^>^ get();
}

See Also

Reference

PipelineSendException Class
PipelineSendException Members


Pop Class

[image]
PowerTCP Mail for .NET
Pop Class
Members Example See Also Send comments on this topic
Dart.Mail Namespace : Pop Class

Glossary Item Box

Integrates Post Office Protocol version 3 (POP3) functionality into any .NET application, allowing applicationS to easily download Internet mail.

Object Model

Pop ClassTcpBase ClassPopMessageCollection ClassPopMessage ClassMailSession Class

Syntax

Visual Basic (Declaration)
Public Class Pop
   Inherits MailBase
Visual Basic (Usage) Copy Code
Dim instance As Pop
C#
public class Pop : MailBase
Managed Extensions for C++
public __gc class Pop : public MailBase
C++/CLI
public ref class Pop : public MailBase

Remarks

Flexible POP message support provides easy retrieval of messages. Features include multiple authentication techniques, downloading into a user-specified Stream, proxy support and the ability to send commands.

Using the Pop Component

A short description of common usage follows. See the "Code Examples" topic for examples in C# and VB.

Easy session management: Authenticate connects and authenticates to the server, and populates Messages with information about the messages present in the mail drop. The session should be explicitly closed using Close.

Message retrieval: Use Pop.Messages[n].Get() to retrieve any message. Messages can be retrieved into a MailMessage.GetEncodingStream() object (for automatic decoding) or into any other user-specified Stream (for saving the encoded message).

"On-the-fly" decoding: Parts are decoded "on the fly" and streamed to memory or disk (for file attachments), minimizing the memory footprint.

Displaying Progress: Progress provides real-time notification of the number of bytes received while downloading.

Viewing POP Protocol Communication: The Pop.Connection.Log event provides access to all commands and data sent over the TCP connection.

Control connection: Connection exposes the TCP connection, allowing access to low-level properties and methods. This can be used to view TCP-level properties, such as the local and remote IP address.

Sending commands: Any command (including proprietary commands) can be sent/received using Connection.Write() and Connection.Read().

Example

In this example, messages are retrieved with the Pop component then saved to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Download all messages in the account and save them to disk with a unique name
    string messageFolder = Application.StartupPath + "\\messages";
    foreach (PopMessage popMessage in pop1.Messages)
    {
        popMessage.Get();
        popMessage.Message.Save(messageFolder + "\\" + popMessage.Id.ToString("D4") + ".eml");
    }

    //Gracefully logout of the session
    pop1.Close();
}

private void pop1_Progress(object sender, PopProgressEventArgs e)
{
    //Update progress bar as messages are received
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Download all messages in the account and save them to disk with a unique name
    Dim messageFolder As String = Application.StartupPath & "\messages"
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get()
        popMessage.Message.Save(messageFolder & "\" & popMessage.Id.ToString("D4") & ".eml")
    Next popMessage

    'Gracefully logout of the session
    pop1.Close()
End Sub

Private Sub pop1_Progress(ByVal sender As Object, ByVal e As PopProgressEventArgs) Handles pop1.Progress
    'Update progress bar as messages are received
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

Inheritance Hierarchy

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.Mail.ComponentBase
Dart.Mail.MailBase
Dart.Mail.Pop

See Also

Reference

Pop Members
Dart.Mail Namespace


Pop Class Members

[image]
PowerTCP Mail for .NET
Pop Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : Pop Class

Glossary Item Box

The following tables list the members exposed by Pop.

Public Constructors

 | Name | Description
Public Constructor | Pop Constructor | Initializes a new instance of the Pop component.
Top

Public Properties

 | Name | Description
Public Property | Capabilities | Gets a List of strings representing the capabilities of the server. (Inherited from Dart.Mail.MailBase)
Public Property | Connection | TCP connection used for server communications.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Specifies the character encoding to be used by the component. (Inherited from Dart.Mail.MailBase)
Public Property | Messages | A PopMessageCollection used to manage all messages.
Public Property | ServerGreeting | Gets the greeting received after connecting to the server. (Inherited from Dart.Mail.MailBase)
Public Property | Session | Specifies connection, authentication and behavior configuration.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

Public Methods

 | Name | Description
Public Method | Authenticate | Authenticate the client using parameters in Pop.Session, and populate Messages.
Public Method | Close | Ceases all activity and gracefully closes the control connection.
Public Method | Connect | Connect to a POP3 server using Session parameters.
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
static (Shared in Visual Basic) | GetDefaultPort | Returns the port normally used for the supplied MailSession configuration.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | Start | Start a worker thread and execute the specified delegate. (Inherited from Dart.Mail.MailBase)
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnProgress | Raises the Progress event.
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | Progress | Raised repeatedly while an email message is retrieved.
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Pop Class
Dart.Mail Namespace


Pop Constructor

[image]
PowerTCP Mail for .NET
Pop Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Pop Class : Pop Constructor

Glossary Item Box

Initializes a new instance of the Pop component.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Pop()
C#
public Pop()
Managed Extensions for C++
public: Pop();
C++/CLI
public:
Pop();

See Also

Reference

Pop Class
Pop Members


Pop Class Methods

[image]
PowerTCP Mail for .NET
Pop Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Pop Class

Glossary Item Box

For a list of all members of this type, see Pop members.

Public Methods

 | Name | Description
Public Method | Authenticate | Authenticate the client using parameters in Pop.Session, and populate Messages.
Public Method | Close | Ceases all activity and gracefully closes the control connection.
Public Method | Connect | Connect to a POP3 server using Session parameters.
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
static (Shared in Visual Basic) | GetDefaultPort | Returns the port normally used for the supplied MailSession configuration.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | Start | Start a worker thread and execute the specified delegate. (Inherited from Dart.Mail.MailBase)
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnProgress | Raises the Progress event.
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Pop Class
Dart.Mail Namespace


Authenticate Method

[image]
PowerTCP Mail for .NET
Authenticate Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Pop Class : Authenticate Method

getSizes
If true, MessageBase.Size is initialized for all messages.
getUids
If true, MessageBase.Uid is initialized for all messages.

Glossary Item Box

Authenticate the client using parameters in Pop.Session, and populate Messages.

Syntax

Visual Basic (Declaration)
Public Sub Authenticate( _
   ByVal getSizes As Boolean, _
   ByVal getUids As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As Pop
Dim getSizes As Boolean
Dim getUids As Boolean

instance.Authenticate(getSizes, getUids)
C#
public void Authenticate(
   bool getSizes,
   bool getUids
)
Managed Extensions for C++
public: void Authenticate(
   bool getSizes,
   bool getUids
)
C++/CLI
public:
void Authenticate(
   bool getSizes,
   bool getUids
)

Parameters

getSizes
If true, MessageBase.Size is initialized for all messages.
getUids
If true, MessageBase.Uid is initialized for all messages.

Exceptions

Exception | Description
ProtocolException | Bad POP protocol response received from server.
System.Net.Sockets.SocketException | The requested address is not valid in its context.

Remarks

SSL security is negotiated if Session.Security.Encrypt == Encrypt.Explicit.

Pop.Messages.Size is initialized.

PopMessage.Get may be used to retrieve any message. The Pop component will remain logged in until Close is called.

Example

This example demonstrates connecting to a Pop server, with options for encryption (Explicit/Implicit), and authenticating the user.
C# Copy Code
using System.Security.Cryptography.X509Certificates;
using System.Security.Authentication;
using System.Net.Security;

/// <summary>
/// Connects to a Pop server, optionally using encryption (Explicit/Implicit), and authenticates the user.
/// </summary>
/// <param name="myPop">The Pop instance to connect and authenticate</param>
/// <param name="hostNameOrAddress">The server's hostname or IP address</param>
/// <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
private void ConnectAndAuthenticate(Pop myPop, string hostNameOrAddress, Authentication auth, string username, string password, Encrypt encryption)
{
    if (encryption != Encrypt.None)
    {
        //Set the method of encryption - Implicit/Explicit
        myPop.Session.Security.Encrypt = encryption;

        //Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        //TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        myPop.Session.Security.Protocols = SslProtocols.Tls | SslProtocols.Ssl3;

        //Specify the server certificate validation callback
        myPop.Session.Security.ValidationCallback = remoteCertificateValidation;
    }

    //Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    //GetDefaultPort() returns the common port used for the security configuration.
    myPop.Session.RemoteEndPoint = new IPEndPoint(hostNameOrAddress, Pop.GetDefaultPort(myPop.Session));

    //Connect to the server.
    myPop.Connect();

    //Authenticate the user.
    myPop.Session.Username = username;
    myPop.Session.Password = password;
    myPop.Session.Authentication = auth;
    myPop.Authenticate(false, true);
}

private bool remoteCertificateValidation(Object sender, X509Certificate remoteCertificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    //the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    return true;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Authentication
Imports System.Net.Security

''' <summary>
''' Connects to a Pop server, optionally using encryption (Explicit/Implicit), and authenticates the user.
''' </summary>
''' <param name="myPop">The Pop instance to connect and authenticate</param>
''' <param name="hostNameOrAddress">The server's hostname or IP address</param>
''' <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
''' <param name="username">Username</param>
''' <param name="password">Password</param>
''' <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
Private Sub ConnectAndAuthenticate(ByVal myPop As Pop, ByVal hostNameOrAddress As String, ByVal auth As Authentication, ByVal username As String, ByVal password As String, ByVal encryption As Encrypt)
    If encryption <> Encrypt.None Then
        'Set the method of encryption - Implicit/Explicit
        myPop.Session.Security.Encrypt = encryption

        'Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        'TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        myPop.Session.Security.Protocols = SslProtocols.Tls Or SslProtocols.Ssl3

        'Specify the server certificate validation callback
        myPop.Session.Security.ValidationCallback = AddressOf remoteCertificateValidation
    End If

    'Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    'GetDefaultPort() returns the common port used for the security configuration.
    myPop.Session.RemoteEndPoint = New IPEndPoint(hostNameOrAddress, Pop.GetDefaultPort(myPop.Session))

    'Connect to the server.
    myPop.Connect()

    'Authenticate the user.
    myPop.Session.Username = username
    myPop.Session.Password = password
    myPop.Session.Authentication = auth
    myPop.Authenticate(False, True)
End Sub

Private Function remoteCertificateValidation(ByVal sender As Object, ByVal remoteCertificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    'the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    Return True
End Function

See Also

Reference

Pop Class
Pop Members


Close Method

[image]
PowerTCP Mail for .NET
Close Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Pop Class : Close Method

Glossary Item Box

Ceases all activity and gracefully closes the control connection.

Syntax

Visual Basic (Declaration)
Public Sub Close()
Visual Basic (Usage) Copy Code
Dim instance As Pop

instance.Close()
C#
public void Close()
Managed Extensions for C++
public: void Close();
C++/CLI
public:
void Close();

Remarks

Sends a "DELE" command for each message marked for deletion, then a "QUIT" command, and waits until the server has closed the connection.

This method is necessary to gracefully end a POP session.

Example

In this example, messages are retrieved with the Pop component then saved to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Download all messages in the account and save them to disk with a unique name
    string messageFolder = Application.StartupPath + "\\messages";
    foreach (PopMessage popMessage in pop1.Messages)
    {
        popMessage.Get();
        popMessage.Message.Save(messageFolder + "\\" + popMessage.Id.ToString("D4") + ".eml");
    }

    //Gracefully logout of the session
    pop1.Close();
}

private void pop1_Progress(object sender, PopProgressEventArgs e)
{
    //Update progress bar as messages are received
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Download all messages in the account and save them to disk with a unique name
    Dim messageFolder As String = Application.StartupPath & "\messages"
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get()
        popMessage.Message.Save(messageFolder & "\" & popMessage.Id.ToString("D4") & ".eml")
    Next popMessage

    'Gracefully logout of the session
    pop1.Close()
End Sub

Private Sub pop1_Progress(ByVal sender As Object, ByVal e As PopProgressEventArgs) Handles pop1.Progress
    'Update progress bar as messages are received
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Pop Class
Pop Members


Connect Method

[image]
PowerTCP Mail for .NET
Connect Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Pop Class : Connect Method

Glossary Item Box

Connect to a POP3 server using Session parameters.

Syntax

Visual Basic (Declaration)
Public Sub Connect()
Visual Basic (Usage) Copy Code
Dim instance As Pop

instance.Connect()
C#
public void Connect()
Managed Extensions for C++
public: void Connect();
C++/CLI
public:
void Connect();

Remarks

SSL encryption is negotiated if Session.Security.Encrypt == Encrypt.Implicit.

Pop.Capabilities is populated after connecting.

If Session.RemoteEndPoint.Port is 0, the default port for the current Session configuration will be used.

Authenticate is normally used after this method. If not, it is up to the application to send any necessary authentication commands to the server.

Example

This example demonstrates connecting to a Pop server, with options for encryption (Explicit/Implicit), and authenticating the user.
C# Copy Code
using System.Security.Cryptography.X509Certificates;
using System.Security.Authentication;
using System.Net.Security;

/// <summary>
/// Connects to a Pop server, optionally using encryption (Explicit/Implicit), and authenticates the user.
/// </summary>
/// <param name="myPop">The Pop instance to connect and authenticate</param>
/// <param name="hostNameOrAddress">The server's hostname or IP address</param>
/// <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
private void ConnectAndAuthenticate(Pop myPop, string hostNameOrAddress, Authentication auth, string username, string password, Encrypt encryption)
{
    if (encryption != Encrypt.None)
    {
        //Set the method of encryption - Implicit/Explicit
        myPop.Session.Security.Encrypt = encryption;

        //Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        //TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        myPop.Session.Security.Protocols = SslProtocols.Tls | SslProtocols.Ssl3;

        //Specify the server certificate validation callback
        myPop.Session.Security.ValidationCallback = remoteCertificateValidation;
    }

    //Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    //GetDefaultPort() returns the common port used for the security configuration.
    myPop.Session.RemoteEndPoint = new IPEndPoint(hostNameOrAddress, Pop.GetDefaultPort(myPop.Session));

    //Connect to the server.
    myPop.Connect();

    //Authenticate the user.
    myPop.Session.Username = username;
    myPop.Session.Password = password;
    myPop.Session.Authentication = auth;
    myPop.Authenticate(false, true);
}

private bool remoteCertificateValidation(Object sender, X509Certificate remoteCertificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    //the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    return true;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Authentication
Imports System.Net.Security

''' <summary>
''' Connects to a Pop server, optionally using encryption (Explicit/Implicit), and authenticates the user.
''' </summary>
''' <param name="myPop">The Pop instance to connect and authenticate</param>
''' <param name="hostNameOrAddress">The server's hostname or IP address</param>
''' <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
''' <param name="username">Username</param>
''' <param name="password">Password</param>
''' <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
Private Sub ConnectAndAuthenticate(ByVal myPop As Pop, ByVal hostNameOrAddress As String, ByVal auth As Authentication, ByVal username As String, ByVal password As String, ByVal encryption As Encrypt)
    If encryption <> Encrypt.None Then
        'Set the method of encryption - Implicit/Explicit
        myPop.Session.Security.Encrypt = encryption

        'Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        'TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        myPop.Session.Security.Protocols = SslProtocols.Tls Or SslProtocols.Ssl3

        'Specify the server certificate validation callback
        myPop.Session.Security.ValidationCallback = AddressOf remoteCertificateValidation
    End If

    'Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    'GetDefaultPort() returns the common port used for the security configuration.
    myPop.Session.RemoteEndPoint = New IPEndPoint(hostNameOrAddress, Pop.GetDefaultPort(myPop.Session))

    'Connect to the server.
    myPop.Connect()

    'Authenticate the user.
    myPop.Session.Username = username
    myPop.Session.Password = password
    myPop.Session.Authentication = auth
    myPop.Authenticate(False, True)
End Sub

Private Function remoteCertificateValidation(ByVal sender As Object, ByVal remoteCertificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    'the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    Return True
End Function

See Also

Reference

Pop Class
Pop Members


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > Pop Class : Dispose Method

Glossary Item Box

Releases all resources associated with the object.

Overload List

Overload | Description
Dispose(Boolean) | Releases all resources associated with the object.
Dispose() | (Inherited from System.ComponentModel.Component)

See Also

Reference

Pop Class
Pop Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > Pop Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As Pop
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method abruptly aborts the connection, releases all resources, and deletes any unmoved decoded attachments and Attachment.Directory.

Dispose should ONLY be used to release all resources used by the object, and the object should not be subsequently used. To gracefully disconnect from the server, use Close before calling this method. The Object cannot be used once Dispose is called.

See Also

Reference

Pop Class
Pop Members
Overload List


GetDefaultPort Method

[image]
PowerTCP Mail for .NET
GetDefaultPort Method
See Also Send comments on this topic
Dart.Mail Namespace > Pop Class : GetDefaultPort Method

session
The MailSession to use for determining the port.

Glossary Item Box

Returns the port normally used for the supplied MailSession configuration.

Syntax

Visual Basic (Declaration)
Public Shared Function GetDefaultPort( _
   ByVal session As MailSession _
) As Integer
Visual Basic (Usage) Copy Code
Dim session As MailSession
Dim value As Integer

value = Pop.GetDefaultPort(session)
C#
public static int GetDefaultPort(
   MailSession session
)
Managed Extensions for C++
public: static int GetDefaultPort(
   MailSession* session
)
C++/CLI
public:
static int GetDefaultPort(
   MailSession^ session
)

Parameters

session
The MailSession to use for determining the port.

Return Value

The port normally used for the supplied MailSession configuration.

Remarks

If MailSecurity.Encrypt == Encrypt.Implicit, port 995 is returned (the well-known secure POP3 server port). Otherwise, 110 is returned (the well-known POP3 server port).

Used to initialize Session.RemoteEndPoint.Port if not initialized by the user.

See Also

Reference

Pop Class
Pop Members


OnProgress Method

[image]
PowerTCP Mail for .NET
OnProgress Method
See Also Send comments on this topic
Dart.Mail Namespace > Pop Class : OnProgress Method

e
PopProgressEventArgs containing event data.

Glossary Item Box

Raises the Progress event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnProgress( _
   ByVal e As PopProgressEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As Pop
Dim e As PopProgressEventArgs

instance.OnProgress(e)
C#
protected virtual void OnProgress(
   PopProgressEventArgs e
)
Managed Extensions for C++
protected: virtual void OnProgress(
   PopProgressEventArgs* e
)
C++/CLI
protected:
virtual void OnProgress(
   PopProgressEventArgs^ e
)

Parameters

e
PopProgressEventArgs containing event data.

Remarks

This method allows derived classes to handle the event without attaching a delegate, but marshaling to the UI thread is not provided. This is the preferred technique for handling an event in a derived class.

Note to Inheritors: When overriding OnProgress in a derived class, be sure to call the base class OnProgress method so that registered delegates receive the event.

See Also

Reference

Pop Class
Pop Members


Pop Class Properties

[image]
PowerTCP Mail for .NET
Pop Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Pop Class

Glossary Item Box

For a list of all members of this type, see Pop members.

Public Properties

 | Name | Description
Public Property | Capabilities | Gets a List of strings representing the capabilities of the server. (Inherited from Dart.Mail.MailBase)
Public Property | Connection | TCP connection used for server communications.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Specifies the character encoding to be used by the component. (Inherited from Dart.Mail.MailBase)
Public Property | Messages | A PopMessageCollection used to manage all messages.
Public Property | ServerGreeting | Gets the greeting received after connecting to the server. (Inherited from Dart.Mail.MailBase)
Public Property | Session | Specifies connection, authentication and behavior configuration.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

See Also

Reference

Pop Class
Dart.Mail Namespace


Connection Property

[image]
PowerTCP Mail for .NET
Connection Property
See Also Send comments on this topic
Dart.Mail Namespace > Pop Class : Connection Property

Glossary Item Box

TCP connection used for server communications.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Connection As TcpBase
Visual Basic (Usage) Copy Code
Dim instance As Pop
Dim value As TcpBase

value = instance.Connection
C#
public TcpBase Connection {get;}
Managed Extensions for C++
public: __property TcpBase* get_Connection();
C++/CLI
public:
property TcpBase^ Connection {
   TcpBase^ get();
}

Property Value

TcpBase

See Also

Reference

Pop Class
Pop Members


Messages Property

[image]
PowerTCP Mail for .NET
Messages Property
See Also Send comments on this topic
Dart.Mail Namespace > Pop Class : Messages Property

Glossary Item Box

A PopMessageCollection used to manage all messages.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Messages As PopMessageCollection
Visual Basic (Usage) Copy Code
Dim instance As Pop
Dim value As PopMessageCollection

value = instance.Messages
C#
public PopMessageCollection Messages {get;}
Managed Extensions for C++
public: __property PopMessageCollection* get_Messages();
C++/CLI
public:
property PopMessageCollection^ Messages {
   PopMessageCollection^ get();
}

Property Value

A PopMessageCollection, representing the messages on the server.

Remarks

Messages on the POP server are managed by referencing Pop.Messages[n]. This list is used to retrieve full or partial messages.

It is populated when the POP server is in the "transaction" state, which occurs after authentication and before logging out. At other times the length of this list is 0. This collection is 0-based, although POP servers will assign an ID that is 1-based. This means that after login, the POP message with ID "1" can be found at Pop.Messages[0], ID "2" at Pop.Messages[1], etc.

See Also

Reference

Pop Class
Pop Members


Session Property

[image]
PowerTCP Mail for .NET
Session Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Pop Class : Session Property

Glossary Item Box

Specifies connection, authentication and behavior configuration.

Syntax

Visual Basic (Declaration)
Public Property Session As MailSession
Visual Basic (Usage) Copy Code
Dim instance As Pop
Dim value As MailSession

instance.Session = value

value = instance.Session
C#
public MailSession Session {get; set;}
Managed Extensions for C++
public: __property MailSession* get_Session();
public: __property void set_Session(
   MailSession* value
);
C++/CLI
public:
property MailSession^ Session {
   MailSession^ get();
   void set (    MailSession^ value);
}

Property Value

MailSession

Remarks

This class is serializable, and can be used to persist a runtime session configuration.

Example

In this example, the Imap component gets messages from a specified mailbox and saves them to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    //Specify folder to store messages
    string messageFolder = Application.StartupPath + "\\messages";

    //Download all messages in the account and save them to disk
    foreach (ImapMessage imapMessage in imap1.SelectedMailbox.ToArray())
    {
        imapMessage.Get();
        imapMessage.Message.Save(messageFolder + "\\" + imapMessage.Uid + ".eml");
    }

    //Gracefully logout of the session
    imap1.Close();
}

private void imap1_Progress(object sender, ImapProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    'Specify folder to store messages
    Dim messageFolder As String = Application.StartupPath & "\messages"

    'Download all messages in the account and save them to disk
    For Each imapMessage As ImapMessage In imap1.SelectedMailbox.ToArray()
        imapMessage.Get()
        imapMessage.Message.Save(messageFolder & "\" & imapMessage.Uid & ".eml")
    Next imapMessage

    'Gracefully logout of the session
    imap1.Close()
End Sub

Private Sub imap1_Progress(ByVal sender As Object, ByVal e As ImapProgressEventArgs) Handles imap1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Pop Class
Pop Members


Pop Class Events

[image]
PowerTCP Mail for .NET
Pop Class Events
See Also Send comments on this topic
Dart.Mail Namespace : Pop Class

Glossary Item Box

For a list of all members of this type, see Pop members.

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | Progress | Raised repeatedly while an email message is retrieved.
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Pop Class
Dart.Mail Namespace


Progress Event

[image]
PowerTCP Mail for .NET
Progress Event
See Also Example Send comments on this topic
Dart.Mail Namespace > Pop Class : Progress Event

Glossary Item Box

Raised repeatedly while an email message is retrieved.

Syntax

Visual Basic (Declaration)
Public Event Progress As EventHandler(Of PopProgressEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As Pop
Dim handler As EventHandler(Of PopProgressEventArgs)

AddHandler instance.Progress, handler
C#
public event EventHandler<PopProgressEventArgs> Progress
Managed Extensions for C++
public: __event EventHandler<PopProgressEventArgs*>* Progress
C++/CLI
public:
event EventHandler<PopProgressEventArgs^>^ Progress

Event Data

The event handler receives an argument of type PopProgressEventArgs containing data related to this event. The following PopProgressEventArgs properties provide information specific to this event.

Property | Description
Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Message | Gets the PopMessage representing the message currently being retrieved.
Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)

Remarks

When a message is retrieved Progress is raised as each data buffer is processed. It contains PopProgressEventArgs, providing data useful for displaying progress to the user. For example, if you wish to display progress for the retrieval of ALL messages using a ProgressBar, use 0 for System.Windows.Forms.ProgressBar.Minimum, pop1.Messages.Length for System.Windows.Forms.ProgressBar.Maximum, and MessageBase.Id as System.Windows.Forms.ProgressBar.Value. If you wish to display progress for each message, use 0 for System.Windows.Forms.ProgressBar.Minimum, ProgressEventArgs.Length for System.Windows.Forms.ProgressBar.Maximum, and ProgressEventArgs.Position for System.Windows.Forms.ProgressBar.Value.

ProgressEventArgs.Length uses MessageBase.Size, so the 'getSizes' parameter of Authenticate must be true if a valid length is desired.

Set ComponentBase.SynchronizingObject to enable marshaling of this event to the UI thread.

Example

In this example, the Pop component gets only message headers, and adds the sender, subject and date to a list.
C# Copy Code
private void previewMessages(object sender)
{
    //Configure server and account info
    pop1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session));
    pop1.Session.Username = myUsername;
    pop1.Session.Password = myPassword;

    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Get header fields for each message in the account
    foreach (PopMessage popMessage in pop1.Messages)
        popMessage.Get(0);

    //Gracefully logout of the session
    pop1.Close();
}

private void pop1_Progress(object sender, PopProgressEventArgs e)
{
    //Display message header info in a listview
    if (e.Final)
    {
        string[] header = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() };
        listView1.Items.Add(new ListViewItem(header));
    }
}
Visual Basic Copy Code
Private Sub previewMessages(ByVal sender As Object)
    'Configure server and account info
    pop1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session))
    pop1.Session.Username = myUsername
    pop1.Session.Password = myPassword

    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Get header fields for each message in the account
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get(0)
    Next popMessage

    'Gracefully logout of the session
    pop1.Close()
End Sub

Private Sub pop1_Progress(ByVal sender As Object, ByVal e As PopProgressEventArgs) Handles pop1.Progress
    'Display message header info in a listview
    If e.Final Then
        Dim header() As String = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() }
        listView1.Items.Add(New ListViewItem(header))
    End If
End Sub

See Also

Reference

Pop Class
Pop Members


PopMessage Class

[image]
PowerTCP Mail for .NET
PopMessage Class
Members Example See Also Send comments on this topic
Dart.Mail Namespace : PopMessage Class

Glossary Item Box

Represents a message the POP server is managing.Represents a message the POP server is managing.

Object Model

PopMessage ClassMailMessage Class

Syntax

Visual Basic (Declaration)
Public Class PopMessage
   Inherits MessageBase
Visual Basic (Usage) Copy Code
Dim instance As PopMessage
C#
public class PopMessage : MessageBase
Managed Extensions for C++
public __gc class PopMessage : public MessageBase
C++/CLI
public ref class PopMessage : public MessageBase

Remarks

A PopMessage object represents a message on the POP server. Messages existing on the POP server are managed through use of Pop.Messages, a collection of PopMessage objects representing the messages available on the server. On login, this array will contain an empty PopMessage for each message on the server; retrieve just the headers with PopMessage.Get(0) for each PopMessage in the array, or retrieve the entire message with PopMessage.Get().

Once you get a message, access the PopMessage.Message property for the MailMessage object encapsulating the message.

PopMessage objects can only be created internally by the Pop component. A PopMessage object cannot be explicitly created by the user.

Example

In this example, messages are retrieved with the Pop component then saved to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Download all messages in the account and save them to disk with a unique name
    string messageFolder = Application.StartupPath + "\\messages";
    foreach (PopMessage popMessage in pop1.Messages)
    {
        popMessage.Get();
        popMessage.Message.Save(messageFolder + "\\" + popMessage.Id.ToString("D4") + ".eml");
    }

    //Gracefully logout of the session
    pop1.Close();
}

private void pop1_Progress(object sender, PopProgressEventArgs e)
{
    //Update progress bar as messages are received
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Download all messages in the account and save them to disk with a unique name
    Dim messageFolder As String = Application.StartupPath & "\messages"
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get()
        popMessage.Message.Save(messageFolder & "\" & popMessage.Id.ToString("D4") & ".eml")
    Next popMessage

    'Gracefully logout of the session
    pop1.Close()
End Sub

Private Sub pop1_Progress(ByVal sender As Object, ByVal e As PopProgressEventArgs) Handles pop1.Progress
    'Update progress bar as messages are received
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

Inheritance Hierarchy

System.Object
Dart.Mail.MessageBase
Dart.Mail.PopMessage

See Also

Reference

PopMessage Members
Dart.Mail Namespace


PopMessage Class Members

[image]
PowerTCP Mail for .NET
PopMessage Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : PopMessage Class

Glossary Item Box

The following tables list the members exposed by PopMessage.

Public Properties

 | Name | Description
Public Property | BodyLines | Gets the number of body lines specified when Get(Int32) was used. 0 indicates only headers were requested. -1 indicates the Message is complete.
Public Property | Deleted | Gets or sets a value indicating whether the message is marked for deletion.
Public Property | Id | Returns the Id of the message. (Inherited from Dart.Mail.MessageBase)
Public Property | Info | Gets the PopMessageInfo enumeration that indicates the state of the Message.
Public Property | Message | Used for referencing the downloaded MailMessage. (Inherited from Dart.Mail.MessageBase)
Public Property | Size | The size of the message in bytes. (Inherited from Dart.Mail.MessageBase)
Public Property | Tag | Gets or sets an object reference that can be used to associate this instance with any other object. (Inherited from Dart.Mail.MessageBase)
Public Property | Uid | Returns the unique identifier of the message. (Inherited from Dart.Mail.MessageBase)
Top

Public Methods

 | Name | Description
Public Method | Get | Overloaded. Gets the message from the server, decodes it, and saves it to Message.
Top

See Also

Reference

PopMessage Class
Dart.Mail Namespace


PopMessage Class Methods

[image]
PowerTCP Mail for .NET
PopMessage Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : PopMessage Class

Glossary Item Box

For a list of all members of this type, see PopMessage members.

Public Methods

 | Name | Description
Public Method | Get | Overloaded. Gets the message from the server, decodes it, and saves it to Message.
Top

See Also

Reference

PopMessage Class
Dart.Mail Namespace


Get Method

[image]
PowerTCP Mail for .NET
Get Method
See Also Send comments on this topic
Dart.Mail Namespace > PopMessage Class : Get Method

Glossary Item Box

Gets the message from the server, decodes it, and saves it to Message.

Overload List

Overload | Description
Get() | Gets the message from the server, decodes it, and saves it to Message.
Get(Int32) | Gets the specified number of bodyLines from the server, decodes the message, and saves it to Message.
Get(Stream) | Gets the encoded message from the server and writes it to the specified Stream.
Get(Stream,Int32) | Gets the specified number of body lines of an encoded message from the server and writes it to the provided Stream. The header is always included.

See Also

Reference

PopMessage Class
PopMessage Members


Get() Method

[image]
PowerTCP Mail for .NET
Get() Method
See Also Example Send comments on this topic
Dart.Mail Namespace > PopMessage Class > Get Method : Get() Method

Glossary Item Box

Gets the message from the server, decodes it, and saves it to Message.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Get()
Visual Basic (Usage) Copy Code
Dim instance As PopMessage

instance.Get()
C#
public void Get()
Managed Extensions for C++
public: void Get();
C++/CLI
public:
void Get();

Example

In this example, messages are retrieved with the Pop component then saved to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Download all messages in the account and save them to disk with a unique name
    string messageFolder = Application.StartupPath + "\\messages";
    foreach (PopMessage popMessage in pop1.Messages)
    {
        popMessage.Get();
        popMessage.Message.Save(messageFolder + "\\" + popMessage.Id.ToString("D4") + ".eml");
    }

    //Gracefully logout of the session
    pop1.Close();
}

private void pop1_Progress(object sender, PopProgressEventArgs e)
{
    //Update progress bar as messages are received
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Download all messages in the account and save them to disk with a unique name
    Dim messageFolder As String = Application.StartupPath & "\messages"
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get()
        popMessage.Message.Save(messageFolder & "\" & popMessage.Id.ToString("D4") & ".eml")
    Next popMessage

    'Gracefully logout of the session
    pop1.Close()
End Sub

Private Sub pop1_Progress(ByVal sender As Object, ByVal e As PopProgressEventArgs) Handles pop1.Progress
    'Update progress bar as messages are received
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

PopMessage Class
PopMessage Members
Overload List


Get(Int32) Method

[image]
PowerTCP Mail for .NET
Get(Int32) Method
See Also Send comments on this topic
Dart.Mail Namespace > PopMessage Class > Get Method : Get(Int32) Method

bodyLines
Number of body lines requested from server. -1 is used to indicate the entire message. 0 gets the header only.

Glossary Item Box

Gets the specified number of bodyLines from the server, decodes the message, and saves it to Message.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Get( _
   ByVal bodyLines As Integer _
)
Visual Basic (Usage) Copy Code
Dim instance As PopMessage
Dim bodyLines As Integer

instance.Get(bodyLines)
C#
public void Get(
   int bodyLines
)
Managed Extensions for C++
public: void Get(
   int bodyLines
)
C++/CLI
public:
void Get(
   int bodyLines
)

Parameters

bodyLines
Number of body lines requested from server. -1 is used to indicate the entire message. 0 gets the header only.

See Also

Reference

PopMessage Class
PopMessage Members
Overload List


Get(Stream) Method

[image]
PowerTCP Mail for .NET
Get(Stream) Method
See Also Send comments on this topic
Dart.Mail Namespace > PopMessage Class > Get Method : Get(Stream) Method

destination
Stream to be written to.

Glossary Item Box

Gets the encoded message from the server and writes it to the specified Stream.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Get( _
   ByVal destination As Stream _
)
Visual Basic (Usage) Copy Code
Dim instance As PopMessage
Dim destination As Stream

instance.Get(destination)
C#
public void Get(
   Stream destination
)
Managed Extensions for C++
public: void Get(
   Stream* destination
)
C++/CLI
public:
void Get(
   Stream^ destination
)

Parameters

destination
Stream to be written to.

Remarks

This method gets a full message. Part.GetEncodingStream is typically used as the destination Stream for on-the-fly decoding, but storage streams can be used to store the message without decoding it.

This method will set Info to PopMessageInfo.Message.

See Also

Reference

PopMessage Class
PopMessage Members
Overload List


Get(Stream,Int32) Method

[image]
PowerTCP Mail for .NET
Get(Stream,Int32) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > PopMessage Class > Get Method : Get(Stream,Int32) Method

destination
Stream to be written to.
bodyLines
Number of body lines requested from server. -1 is used to indicate the entire message. 0 gets the header only.

Glossary Item Box

Gets the specified number of body lines of an encoded message from the server and writes it to the provided Stream. The header is always included.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Get( _
   ByVal destination As Stream, _
   ByVal bodyLines As Integer _
)
Visual Basic (Usage) Copy Code
Dim instance As PopMessage
Dim destination As Stream
Dim bodyLines As Integer

instance.Get(destination, bodyLines)
C#
public void Get(
   Stream destination,
   int bodyLines
)
Managed Extensions for C++
public: void Get(
   Stream* destination,
   int bodyLines
)
C++/CLI
public:
void Get(
   Stream^ destination,
   int bodyLines
)

Parameters

destination
Stream to be written to.
bodyLines
Number of body lines requested from server. -1 is used to indicate the entire message. 0 gets the header only.

Remarks

This method gets a partial message. Part.GetEncodingStream is typically used as the destination Stream for on-the-fly decoding, but storage streams can be used to store the message without decoding it.

This method will set Info as applicable for the value of bodyLines.

Example

In this example, the Pop component gets only message headers, and adds the sender, subject and date to a list.
C# Copy Code
private void previewMessages(object sender)
{
    //Configure server and account info
    pop1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session));
    pop1.Session.Username = myUsername;
    pop1.Session.Password = myPassword;

    //Connect and log into the account
    pop1.Connect();
    pop1.Authenticate(true, true);

    //Get header fields for each message in the account
    foreach (PopMessage popMessage in pop1.Messages)
        popMessage.Get(0);

    //Gracefully logout of the session
    pop1.Close();
}

private void pop1_Progress(object sender, PopProgressEventArgs e)
{
    //Display message header info in a listview
    if (e.Final)
    {
        string[] header = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() };
        listView1.Items.Add(new ListViewItem(header));
    }
}
Visual Basic Copy Code
Private Sub previewMessages(ByVal sender As Object)
    'Configure server and account info
    pop1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session))
    pop1.Session.Username = myUsername
    pop1.Session.Password = myPassword

    'Connect and log into the account
    pop1.Connect()
    pop1.Authenticate(True, True)

    'Get header fields for each message in the account
    For Each popMessage As PopMessage In pop1.Messages
        popMessage.Get(0)
    Next popMessage

    'Gracefully logout of the session
    pop1.Close()
End Sub

Private Sub pop1_Progress(ByVal sender As Object, ByVal e As PopProgressEventArgs) Handles pop1.Progress
    'Display message header info in a listview
    If e.Final Then
        Dim header() As String = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() }
        listView1.Items.Add(New ListViewItem(header))
    End If
End Sub

See Also

Reference

PopMessage Class
PopMessage Members
Overload List


PopMessage Class Properties

[image]
PowerTCP Mail for .NET
PopMessage Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : PopMessage Class

Glossary Item Box

For a list of all members of this type, see PopMessage members.

Public Properties

 | Name | Description
Public Property | BodyLines | Gets the number of body lines specified when Get(Int32) was used. 0 indicates only headers were requested. -1 indicates the Message is complete.
Public Property | Deleted | Gets or sets a value indicating whether the message is marked for deletion.
Public Property | Id | Returns the Id of the message. (Inherited from Dart.Mail.MessageBase)
Public Property | Info | Gets the PopMessageInfo enumeration that indicates the state of the Message.
Public Property | Message | Used for referencing the downloaded MailMessage. (Inherited from Dart.Mail.MessageBase)
Public Property | Size | The size of the message in bytes. (Inherited from Dart.Mail.MessageBase)
Public Property | Tag | Gets or sets an object reference that can be used to associate this instance with any other object. (Inherited from Dart.Mail.MessageBase)
Public Property | Uid | Returns the unique identifier of the message. (Inherited from Dart.Mail.MessageBase)
Top

See Also

Reference

PopMessage Class
Dart.Mail Namespace


BodyLines Property

[image]
PowerTCP Mail for .NET
BodyLines Property
See Also Send comments on this topic
Dart.Mail Namespace > PopMessage Class : BodyLines Property

Glossary Item Box

Gets the number of body lines specified when Get(Int32) was used. 0 indicates only headers were requested. -1 indicates the Message is complete.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property BodyLines As Integer
Visual Basic (Usage) Copy Code
Dim instance As PopMessage
Dim value As Integer

value = instance.BodyLines
C#
public int BodyLines {get;}
Managed Extensions for C++
public: __property int get_BodyLines();
C++/CLI
public:
property int BodyLines {
   int get();
}

Remarks

Returns -2 when the Message has not been initialized.

See Also

Reference

PopMessage Class
PopMessage Members


Deleted Property

[image]
PowerTCP Mail for .NET
Deleted Property
See Also Send comments on this topic
Dart.Mail Namespace > PopMessage Class : Deleted Property

Glossary Item Box

Gets or sets a value indicating whether the message is marked for deletion.

Syntax

Visual Basic (Declaration)
Public Property Deleted As Boolean
Visual Basic (Usage) Copy Code
Dim instance As PopMessage
Dim value As Boolean

instance.Deleted = value

value = instance.Deleted
C#
public bool Deleted {get; set;}
Managed Extensions for C++
public: __property bool get_Deleted();
public: __property void set_Deleted(
   bool value
);
C++/CLI
public:
property bool Deleted {
   bool get();
   void set (    bool value);
}

Property Value

true if the message has been marked for deletion, false otherwise. The default value is false.

Remarks

Marked messages are deleted when Close is used.

See Also

Reference

PopMessage Class
PopMessage Members


Info Property

[image]
PowerTCP Mail for .NET
Info Property
See Also Send comments on this topic
Dart.Mail Namespace > PopMessage Class : Info Property

Glossary Item Box

Gets the PopMessageInfo enumeration that indicates the state of the Message.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Info As PopMessageInfo
Visual Basic (Usage) Copy Code
Dim instance As PopMessage
Dim value As PopMessageInfo

value = instance.Info
C#
public PopMessageInfo Info {get;}
Managed Extensions for C++
public: __property PopMessageInfo get_Info();
C++/CLI
public:
property PopMessageInfo Info {
   PopMessageInfo get();
}

See Also

Reference

PopMessage Class
PopMessage Members


PopMessageCollection Class

[image]
PowerTCP Mail for .NET
PopMessageCollection Class
Members See Also Send comments on this topic
Dart.Mail Namespace : PopMessageCollection Class

Glossary Item Box

A List of PopMessage objects representing the mail messages on the POP server.

Object Model

PopMessageCollection ClassPopMessage Class

Syntax

Visual Basic (Declaration)
Public Class PopMessageCollection
   Inherits System.Collections.Generic.List(Of PopMessage)
Visual Basic (Usage) Copy Code
Dim instance As PopMessageCollection
C#
public class PopMessageCollection : System.Collections.Generic.List<PopMessage>
Managed Extensions for C++
public __gc class PopMessageCollection : public System.Collections.Generic.List<PopMessage>
C++/CLI
public ref class PopMessageCollection : public System.Collections.Generic.List<PopMessage>

Inheritance Hierarchy

System.Object
System.Collections.Generic.List<T>
Dart.Mail.PopMessageCollection

See Also

Reference

PopMessageCollection Members
Dart.Mail Namespace


PopMessageCollection Class Members

[image]
PowerTCP Mail for .NET
PopMessageCollection Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : PopMessageCollection Class

Glossary Item Box

The following tables list the members exposed by PopMessageCollection.

Public Constructors

 | Name | Description
Public Constructor | PopMessageCollection Constructor |
Top

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Property | Count | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Property | Item | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Property | Size | Gets the number of bytes contained in all messages present.
Top

Public Methods

 | Name | Description
Public Method | Add | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | AddRange | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Clear | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Contains | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Exists | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Find | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | GetRange | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Insert | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Remove | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | RemoveAt | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | ToArray | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<PopMessage>)
Top

See Also

Reference

PopMessageCollection Class
Dart.Mail Namespace


PopMessageCollection Constructor

[image]
PowerTCP Mail for .NET
PopMessageCollection Constructor
See Also Send comments on this topic
Dart.Mail Namespace > PopMessageCollection Class : PopMessageCollection Constructor

Glossary Item Box

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New PopMessageCollection()
C#
public PopMessageCollection()
Managed Extensions for C++
public: PopMessageCollection();
C++/CLI
public:
PopMessageCollection();

See Also

Reference

PopMessageCollection Class
PopMessageCollection Members


PopMessageCollection Class Properties

[image]
PowerTCP Mail for .NET
PopMessageCollection Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : PopMessageCollection Class

Glossary Item Box

For a list of all members of this type, see PopMessageCollection members.

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Property | Count | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Property | Item | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Property | Size | Gets the number of bytes contained in all messages present.
Top

See Also

Reference

PopMessageCollection Class
Dart.Mail Namespace


Size Property

[image]
PowerTCP Mail for .NET
Size Property
See Also Send comments on this topic
Dart.Mail Namespace > PopMessageCollection Class : Size Property

Glossary Item Box

Gets the number of bytes contained in all messages present.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Size As Long
Visual Basic (Usage) Copy Code
Dim instance As PopMessageCollection
Dim value As Long

value = instance.Size
C#
public long Size {get;}
Managed Extensions for C++
public: __property long get_Size();
C++/CLI
public:
property int64 Size {
   int64 get();
}

Property Value

A long representing the number of bytes of all messages in the mail drop.

Remarks

Returns the size (in bytes) of all user messages present on the POP server. When not logged in, this property returns 0. The number of bytes reported may be less than the size of the downloaded messages due to linefeed encoding.

See Also

Reference

PopMessageCollection Class
PopMessageCollection Members


PopProgressEventArgs Class

[image]
PowerTCP Mail for .NET
PopProgressEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : PopProgressEventArgs Class

Glossary Item Box

Provides data for Pop.Progress.

Object Model

PopProgressEventArgs ClassPopMessage Class

Syntax

Visual Basic (Declaration)
Public Class PopProgressEventArgs
   Inherits ProgressEventArgs
Visual Basic (Usage) Copy Code
Dim instance As PopProgressEventArgs
C#
public class PopProgressEventArgs : ProgressEventArgs
Managed Extensions for C++
public __gc class PopProgressEventArgs : public ProgressEventArgs
C++/CLI
public ref class PopProgressEventArgs : public ProgressEventArgs

Remarks

Progress is raised as each data buffer is processed during message retrieval. This event include a PopProgressEventArgs, providing data for displaying progress to the user. For example, if you wish to display progress for the retrieval of ALL messages using a ProgressBar, use 0 for System.Windows.Forms.ProgressBar.Minimum, pop1.Messages.Length for System.Windows.Forms.ProgressBar.Maximum, and MessageBase.Id as System.Windows.Forms.ProgressBar.Value. If you wish to display progress for each message, use 0 for System.Windows.Forms.ProgressBar.Minimum, ProgressEventArgs.Length for System.Windows.Forms.ProgressBar.Maximum, and ProgressEventArgs.Position for System.Windows.Forms.ProgressBar.Value.

ProgressEventArgs.Length uses MessageBase.Size, so the 'getSizes' parameter of Authenticate must be true if a valid length is desired.

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.ProgressEventArgs
Dart.Mail.PopProgressEventArgs

See Also

Reference

PopProgressEventArgs Members
Dart.Mail Namespace


PopProgressEventArgs Class Members

[image]
PowerTCP Mail for .NET
PopProgressEventArgs Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : PopProgressEventArgs Class

Glossary Item Box

The following tables list the members exposed by PopProgressEventArgs.

Public Properties

 | Name | Description
Public Property | Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Message | Gets the PopMessage representing the message currently being retrieved.
Public Property | Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Top

See Also

Reference

PopProgressEventArgs Class
Dart.Mail Namespace


PopProgressEventArgs Class Properties

[image]
PowerTCP Mail for .NET
PopProgressEventArgs Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : PopProgressEventArgs Class

Glossary Item Box

For a list of all members of this type, see PopProgressEventArgs members.

Public Properties

 | Name | Description
Public Property | Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Message | Gets the PopMessage representing the message currently being retrieved.
Public Property | Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Top

See Also

Reference

PopProgressEventArgs Class
Dart.Mail Namespace


Message Property

[image]
PowerTCP Mail for .NET
Message Property
See Also Send comments on this topic
Dart.Mail Namespace > PopProgressEventArgs Class : Message Property

Glossary Item Box

Gets the PopMessage representing the message currently being retrieved.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Message As PopMessage
Visual Basic (Usage) Copy Code
Dim instance As PopProgressEventArgs
Dim value As PopMessage

value = instance.Message
C#
public PopMessage Message {get;}
Managed Extensions for C++
public: __property PopMessage* get_Message();
C++/CLI
public:
property PopMessage^ Message {
   PopMessage^ get();
}

Property Value

A PopMessage object representing the message retrieved.

Remarks

This is useful for displaying progress data specific to a particular message, such as MessageBase.Id.

See Also

Reference

PopProgressEventArgs Class
PopProgressEventArgs Members


ProgressEventArgs Class

[image]
PowerTCP Mail for .NET
ProgressEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ProgressEventArgs Class

Glossary Item Box

Base class for PopProgressEventArgs, ImapProgressEventArgs and SmtpProgressEventArgs.

Object Model

ProgressEventArgs Class

Syntax

Visual Basic (Declaration)
Public Class ProgressEventArgs
   Inherits System.EventArgs
Visual Basic (Usage) Copy Code
Dim instance As ProgressEventArgs
C#
public class ProgressEventArgs : System.EventArgs
Managed Extensions for C++
public __gc class ProgressEventArgs : public System.EventArgs
C++/CLI
public ref class ProgressEventArgs : public System.EventArgs

Remarks

Provides data useful for displaying progress to the user.

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.ProgressEventArgs
Dart.Mail.ImapProgressEventArgs
Dart.Mail.PopProgressEventArgs
Dart.Mail.SmtpProgressEventArgs

See Also

Reference

ProgressEventArgs Members
Dart.Mail Namespace


ProgressEventArgs Class Members

[image]
PowerTCP Mail for .NET
ProgressEventArgs Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : ProgressEventArgs Class

Glossary Item Box

The following tables list the members exposed by ProgressEventArgs.

Public Properties

 | Name | Description
Public Property | Final | Returns true the last time a Progress event is raised for a given message.
Public Property | Length | The length of the message data.
Public Property | Position | The position within the message data.
Top

See Also

Reference

ProgressEventArgs Class
Dart.Mail Namespace


ProgressEventArgs Class Properties

[image]
PowerTCP Mail for .NET
ProgressEventArgs Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ProgressEventArgs Class

Glossary Item Box

For a list of all members of this type, see ProgressEventArgs members.

Public Properties

 | Name | Description
Public Property | Final | Returns true the last time a Progress event is raised for a given message.
Public Property | Length | The length of the message data.
Public Property | Position | The position within the message data.
Top

See Also

Reference

ProgressEventArgs Class
Dart.Mail Namespace


Final Property

[image]
PowerTCP Mail for .NET
Final Property
See Also Send comments on this topic
Dart.Mail Namespace > ProgressEventArgs Class : Final Property

Glossary Item Box

Returns true the last time a Progress event is raised for a given message.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Final As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ProgressEventArgs
Dim value As Boolean

value = instance.Final
C#
public bool Final {get;}
Managed Extensions for C++
public: __property bool get_Final();
C++/CLI
public:
property bool Final {
   bool get();
}

Property Value

A boolean.

Remarks

This is useful for displaying status information immediately after a message has been sent or received.

See Also

Reference

ProgressEventArgs Class
ProgressEventArgs Members


Length Property

[image]
PowerTCP Mail for .NET
Length Property
See Also Send comments on this topic
Dart.Mail Namespace > ProgressEventArgs Class : Length Property

Glossary Item Box

The length of the message data.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Length As Long
Visual Basic (Usage) Copy Code
Dim instance As ProgressEventArgs
Dim value As Long

value = instance.Length
C#
public long Length {get;}
Managed Extensions for C++
public: __property long get_Length();
C++/CLI
public:
property int64 Length {
   int64 get();
}

Property Value

A long representing the number of bytes in the message.

Remarks

This value represents the total number of bytes in the retrieved message. Position divided by Length gives the percentage complete.

Position equals Length when all data has been transferred.

See Also

Reference

ProgressEventArgs Class
ProgressEventArgs Members


Position Property

[image]
PowerTCP Mail for .NET
Position Property
See Also Send comments on this topic
Dart.Mail Namespace > ProgressEventArgs Class : Position Property

Glossary Item Box

The position within the message data.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Position As Long
Visual Basic (Usage) Copy Code
Dim instance As ProgressEventArgs
Dim value As Long

value = instance.Position
C#
public long Position {get;}
Managed Extensions for C++
public: __property long get_Position();
C++/CLI
public:
property int64 Position {
   int64 get();
}

Property Value

A long representing the current position within the message data.

Remarks

This value represents the position within the retrieved message at the time the Progress event is raised. Position divided by Length gives the percentage complete.

Position equals Length when all data has been transferred.

See Also

Reference

ProgressEventArgs Class
ProgressEventArgs Members


ProtocolException Class

[image]
PowerTCP Mail for .NET
ProtocolException Class
Members See Also Send comments on this topic
Dart.Mail Namespace : ProtocolException Class

Glossary Item Box

Thrown when an upper-layer protocol like FTP, SMTP or POP3 receives a negative response from the server.

Object Model

ProtocolException Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class ProtocolException
   Inherits System.ApplicationException
Visual Basic (Usage) Copy Code
Dim instance As ProtocolException
C#
[Serializable()]
public class ProtocolException : System.ApplicationException
Managed Extensions for C++
[Serializable()]
public __gc class ProtocolException : public System.ApplicationException
C++/CLI
[Serializable()]
public ref class ProtocolException : public System.ApplicationException

Remarks

This exception is thrown when a server response is negative. For example, if an FTP server returned a "500" respose (indicating a syntax error) to a sent command.

Inheritance Hierarchy

System.Object
System.Exception
System.ApplicationException
Dart.Mail.ProtocolException

See Also

Reference

ProtocolException Members
Dart.Mail Namespace


ProtocolException Class Members

[image]
PowerTCP Mail for .NET
ProtocolException Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : ProtocolException Class

Glossary Item Box

The following tables list the members exposed by ProtocolException.

Protected Constructors

 | Name | Description
Protected Constructor | ProtocolException Constructor | Initializes a new ProtocolException.
Top

Public Properties

 | Name | Description
Public Property | Data | (Inherited from System.Exception)
Public Property | HelpLink | (Inherited from System.Exception)
Public Property | HResult | (Inherited from System.Exception)
Public Property | InnerException | (Inherited from System.Exception)
Public Property | Message | (Inherited from System.Exception)
Public Property | Source | (Inherited from System.Exception)
Public Property | StackTrace | (Inherited from System.Exception)
Public Property | TargetSite | (Inherited from System.Exception)
Top

Public Methods

 | Name | Description
Public Method | GetBaseException | (Inherited from System.Exception)
Public Method | GetObjectData | (Inherited from System.Exception)
Public Method | GetType | (Inherited from System.Exception)
Public Method | ToString | (Inherited from System.Exception)
Top

Protected Events

 | Name | Description
Protected Event | SerializeObjectState | (Inherited from System.Exception)
Top

See Also

Reference

ProtocolException Class
Dart.Mail Namespace


ProtocolException Constructor

[image]
PowerTCP Mail for .NET
ProtocolException Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ProtocolException Class : ProtocolException Constructor

info
context

Glossary Item Box

Initializes a new ProtocolException.

Syntax

Visual Basic (Declaration)
Protected Function New( _
   ByVal info As SerializationInfo, _
   ByVal context As StreamingContext _
)
Visual Basic (Usage) Copy Code
Dim info As SerializationInfo
Dim context As StreamingContext

Dim instance As New ProtocolException(info, context)
C#
protected ProtocolException(
   SerializationInfo info,
   StreamingContext context
)
Managed Extensions for C++
protected: ProtocolException(
   SerializationInfo* info,
   StreamingContext context
)
C++/CLI
protected:
ProtocolException(
   SerializationInfo^ info,
   StreamingContext context
)

Parameters

info
context

See Also

Reference

ProtocolException Class
ProtocolException Members


Proxy Class

[image]
PowerTCP Mail for .NET
Proxy Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Proxy Class

Glossary Item Box

Describes the server proxy, if any, to connect to.

Object Model

Proxy ClassIPEndPoint Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class Proxy
Visual Basic (Usage) Copy Code
Dim instance As Proxy
C#
[Serializable()]
public class Proxy
Managed Extensions for C++
[Serializable()]
public __gc class Proxy
C++/CLI
[Serializable()]
public ref class Proxy

Inheritance Hierarchy

System.Object
Dart.Mail.Proxy

See Also

Reference

Proxy Members
Dart.Mail Namespace


Proxy Class Members

[image]
PowerTCP Mail for .NET
Proxy Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : Proxy Class

Glossary Item Box

The following tables list the members exposed by Proxy.

Public Constructors

 | Name | Description
Public Constructor | Proxy Constructor | The default constructor for Proxy
Top

Public Properties

 | Name | Description
Public Property | Password | The password to send to the server proxy. Not used for Socks4.
Public Property | RemoteEndPoint | IPEndPoint of the server proxy to connect to.
Public Property | Type | The ProxyType desired.
Public Property | Username | The username to send to the server proxy.
Top

See Also

Reference

Proxy Class
Dart.Mail Namespace


Proxy Constructor

[image]
PowerTCP Mail for .NET
Proxy Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Proxy Class : Proxy Constructor

Glossary Item Box

The default constructor for Proxy

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Proxy()
C#
public Proxy()
Managed Extensions for C++
public: Proxy();
C++/CLI
public:
Proxy();

See Also

Reference

Proxy Class
Proxy Members


Proxy Class Properties

[image]
PowerTCP Mail for .NET
Proxy Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Proxy Class

Glossary Item Box

For a list of all members of this type, see Proxy members.

Public Properties

 | Name | Description
Public Property | Password | The password to send to the server proxy. Not used for Socks4.
Public Property | RemoteEndPoint | IPEndPoint of the server proxy to connect to.
Public Property | Type | The ProxyType desired.
Public Property | Username | The username to send to the server proxy.
Top

See Also

Reference

Proxy Class
Dart.Mail Namespace


Password Property

[image]
PowerTCP Mail for .NET
Password Property
See Also Send comments on this topic
Dart.Mail Namespace > Proxy Class : Password Property

Glossary Item Box

The password to send to the server proxy. Not used for Socks4.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Password As String
Visual Basic (Usage) Copy Code
Dim instance As Proxy
Dim value As String

instance.Password = value

value = instance.Password
C#
[DefaultValue()]
public string Password {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property string* get_Password();
public: __property void set_Password(
   string* value
);
C++/CLI
[DefaultValue()]
public:
property String^ Password {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

Proxy Class
Proxy Members


RemoteEndPoint Property

[image]
PowerTCP Mail for .NET
RemoteEndPoint Property
See Also Send comments on this topic
Dart.Mail Namespace > Proxy Class : RemoteEndPoint Property

Glossary Item Box

IPEndPoint of the server proxy to connect to.

Syntax

Visual Basic (Declaration)
Public Property RemoteEndPoint As IPEndPoint
Visual Basic (Usage) Copy Code
Dim instance As Proxy
Dim value As IPEndPoint

instance.RemoteEndPoint = value

value = instance.RemoteEndPoint
C#
public IPEndPoint RemoteEndPoint {get; set;}
Managed Extensions for C++
public: __property IPEndPoint* get_RemoteEndPoint();
public: __property void set_RemoteEndPoint(
   IPEndPoint* value
);
C++/CLI
public:
property IPEndPoint^ RemoteEndPoint {
   IPEndPoint^ get();
   void set (    IPEndPoint^ value);
}

See Also

Reference

Proxy Class
Proxy Members


Type Property

[image]
PowerTCP Mail for .NET
Type Property
See Also Send comments on this topic
Dart.Mail Namespace > Proxy Class : Type Property

Glossary Item Box

The ProxyType desired.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Type As ProxyType
Visual Basic (Usage) Copy Code
Dim instance As Proxy
Dim value As ProxyType

instance.Type = value

value = instance.Type
C#
[DefaultValue()]
public ProxyType Type {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property ProxyType get_Type();
public: __property void set_Type(
   ProxyType value
);
C++/CLI
[DefaultValue()]
public:
property ProxyType Type {
   ProxyType get();
   void set (    ProxyType value);
}

See Also

Reference

Proxy Class
Proxy Members


Username Property

[image]
PowerTCP Mail for .NET
Username Property
See Also Send comments on this topic
Dart.Mail Namespace > Proxy Class : Username Property

Glossary Item Box

The username to send to the server proxy.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Username As String
Visual Basic (Usage) Copy Code
Dim instance As Proxy
Dim value As String

instance.Username = value

value = instance.Username
C#
[DefaultValue()]
public string Username {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property string* get_Username();
public: __property void set_Username(
   string* value
);
C++/CLI
[DefaultValue()]
public:
property String^ Username {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

Proxy Class
Proxy Members


Recipient Class

[image]
PowerTCP Mail for .NET
Recipient Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Recipient Class

Glossary Item Box

Associates a recipient's System.Net.Mail.MailAddress with the response received from the server when the address was submitted.

Object Model

Recipient Class

Syntax

Visual Basic (Declaration)
Public Class Recipient
Visual Basic (Usage) Copy Code
Dim instance As Recipient
C#
public class Recipient
Managed Extensions for C++
public __gc class Recipient
C++/CLI
public ref class Recipient

Inheritance Hierarchy

System.Object
Dart.Mail.Recipient

See Also

Reference

Recipient Members
Dart.Mail Namespace


Recipient Class Members

[image]
PowerTCP Mail for .NET
Recipient Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : Recipient Class

Glossary Item Box

The following tables list the members exposed by Recipient.

Public Properties

 | Name | Description
Public Property | MailAddress | MailAddress of the email recipient.
Public Property | ServerResponse | Response received from the email server when the address was sent using the "RCPT TO:" command.
Top

See Also

Reference

Recipient Class
Dart.Mail Namespace


Recipient Class Properties

[image]
PowerTCP Mail for .NET
Recipient Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Recipient Class

Glossary Item Box

For a list of all members of this type, see Recipient members.

Public Properties

 | Name | Description
Public Property | MailAddress | MailAddress of the email recipient.
Public Property | ServerResponse | Response received from the email server when the address was sent using the "RCPT TO:" command.
Top

See Also

Reference

Recipient Class
Dart.Mail Namespace


MailAddress Property

[image]
PowerTCP Mail for .NET
MailAddress Property
See Also Send comments on this topic
Dart.Mail Namespace > Recipient Class : MailAddress Property

Glossary Item Box

MailAddress of the email recipient.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property MailAddress As MailAddress
Visual Basic (Usage) Copy Code
Dim instance As Recipient
Dim value As MailAddress

value = instance.MailAddress
C#
public MailAddress MailAddress {get;}
Managed Extensions for C++
public: __property MailAddress* get_MailAddress();
C++/CLI
public:
property MailAddress^ MailAddress {
   MailAddress^ get();
}

See Also

Reference

Recipient Class
Recipient Members


ServerResponse Property

[image]
PowerTCP Mail for .NET
ServerResponse Property
See Also Send comments on this topic
Dart.Mail Namespace > Recipient Class : ServerResponse Property

Glossary Item Box

Response received from the email server when the address was sent using the "RCPT TO:" command.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property ServerResponse As Response
Visual Basic (Usage) Copy Code
Dim instance As Recipient
Dim value As Response

value = instance.ServerResponse
C#
public Response ServerResponse {get;}
Managed Extensions for C++
public: __property Response* get_ServerResponse();
C++/CLI
public:
property Response^ ServerResponse {
   Response^ get();
}

See Also

Reference

Recipient Class
Recipient Members


Resource Class

[image]
PowerTCP Mail for .NET
Resource Class
Members Example See Also Send comments on this topic
Dart.Mail Namespace : Resource Class

Glossary Item Box

Implements base functionality for classes that have a header and a single part (not multi-part).

Object Model

Resource ClassContentDisposition ClassContentType ClassHeaderDictionary ClassHeaderField Class

Syntax

Visual Basic (Declaration)
Public Class Resource
   Inherits Part
Visual Basic (Usage) Copy Code
Dim instance As Resource
C#
public class Resource : Part
Managed Extensions for C++
public __gc class Resource : public Part
C++/CLI
public ref class Resource : public Part

Remarks

This class can be used to customize a single part for any use.

Example

Demonstrates saving resources to disk. This example demonstrates creating a new MailMessage and populating it with HTML that references local files, such as a "Webpage, complete (*.htm;*.html)" as saved by Internet Explorer.
C# Copy Code
/// <summary>
/// Saves the email's resources (files intended for display within the HTML
/// message body) to the specified directory.
/// </summary>
/// <param name="message">MailMessage containing resources to save.</param>
/// <param name="saveDirectory">Directory to save resources to.</param>
private void SaveResources(MailMessage message, string saveDirectory)
{
    foreach (Resource res in message.Resources)
    {
        string filePath = Path.Combine(saveDirectory, res.ContentType.Name);
        using (FileStream fs = new FileStream(filePath, FileMode.CreateNew, FileAccess.Write))
            fs.Write(res.Content, 0, res.Content.Length);
    }
}
Visual Basic Copy Code
''' <summary>
''' Saves the email's resources (files intended for display within the HTML
''' message body) to the specified directory.
''' </summary>
''' <param name="message">MailMessage containing resources to save.</param>
''' <param name="saveDirectory">Directory to save resources to.</param>
Private Sub SaveResources(ByVal message As MailMessage, ByVal saveDirectory As String)
    For Each res As Resource In message.Resources
        Dim filePath As String = Path.Combine(saveDirectory, res.ContentType.Name)
        Using fs As New FileStream(filePath, FileMode.CreateNew, FileAccess.Write)
            fs.Write(res.Content, 0, res.Content.Length)
        End Using
    Next res
End Sub
C# Copy Code
private MailMessage getMessageFromHtml(string pathToHtml, string pathToHtmlResources, string from, string to, string subject, bool includeTextPlain)
{
    //Note: to load a .mht (Mime HTML) file, use MailMessage.Open() instead.

    //Load HTML
    string html;
    using (StreamReader sr = new StreamReader(pathToHtml))
        html = sr.ReadToEnd();

    //Initialize a MailMessage object. includeTextPlain controls whether the message should include a text/plain part
    //(which determines whether the message is multipart/alternative (when true) or multipart/related (when false))
    string textPlain = (includeTextPlain) ? "text/plain representation of included HTML" : null;
    MailMessage mailMsg = new MailMessage(textPlain, html, new DirectoryInfo(pathToHtmlResources).GetFiles());

    //Set sender, recipients and subject
    mailMsg.From = from;
    mailMsg.To = to;
    mailMsg.Subject = subject;
    return mailMsg;
}
Visual Basic Copy Code
Private Function getMessageFromHtml(ByVal pathToHtml As String, ByVal fromAddress As String, ByVal toAddress As String, ByVal subject As String) As MailMessage
     'Note: to load a .mht (Mime HTML) file, use MailMessage.Open() instead.

     'Load HTML
     Dim sr As New StreamReader(pathToHtml)
     Dim html As String = sr.ReadToEnd()
     sr.Close()

     'Initialize a MailMessage object. includeTextPlain controls whether the message should include a
     'text/plain part (which determines whether the message is multipart/alternative (when true) or multipart/related (when false))
     Dim textPlain As String = If(includeTextPlain, "text/plain representation of included HTML", Nothing)
     Dim mailMsg As New MailMessage(textPlain, html, New DirectoryInfo(pathToHtmlResources).GetFiles())

     'Set sender, recipients and subject
     mailMsg.From = fromAddress
     mailMsg.To = toAddress
     mailMsg.Subject = subject
     Return mailMsg
End Function

Inheritance Hierarchy

System.Object
Dart.Mail.Part
Dart.Mail.Resource
Dart.Mail.Attachment
Dart.Mail.Messagepart
Dart.Mail.Textpart

See Also

Reference

Resource Members
Dart.Mail Namespace


Resource Class Members

[image]
PowerTCP Mail for .NET
Resource Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : Resource Class

Glossary Item Box

The following tables list the members exposed by Resource.

Public Constructors

 | Name | Description
Public Constructor | Resource Constructor | Overloaded.
Top

Public Properties

 | Name | Description
Public Property | Content | Gets or sets the decoded Content of the part.
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part.
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part.
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Headers | Provides a Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part.
Top

Public Methods

 | Name | Description
Public Method | Clear | Overridden. Reinitializes the part to default (empty) values.
Public Method | Clone | Overridden. Creates a deep copy of the Resource part, but a shallow copy of its Content.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content.
Public Method | Dispose | Overloaded. Releases all resources associated with the object. (Inherited from Dart.Mail.Part)
Public Method | GetContentEncodingStream | Overridden. Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.
Public Method | GetContentStream | Gets a Stream that contains decoded byte content from Content.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType.
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Resource Class
Dart.Mail Namespace


Resource Constructor

[image]
PowerTCP Mail for .NET
Resource Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : Resource Constructor

Glossary Item Box

Overload List

Overload | Description
Resource Constructor() | Default constructor.
Resource Constructor(Byte[]) | Constructor used to subsequently encode the provided Stream.
Resource Constructor(Byte[],String) | Constructor used to create a new Resource and associate it with existing binary data.
Resource Constructor(Stream,String) | Constructor used to create a new Resource and associate it with existing binary data from a Stream.

See Also

Reference

Resource Class
Resource Members


Resource Constructor()

[image]
PowerTCP Mail for .NET
Resource Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class > Resource Constructor : Resource Constructor()

Glossary Item Box

Default constructor.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Resource()
C#
public Resource()
Managed Extensions for C++
public: Resource();
C++/CLI
public:
Resource();

Remarks

Content is not initialized (remains null).

See Also

Reference

Resource Class
Resource Members
Overload List


Resource Constructor(Byte[])

[image]
PowerTCP Mail for .NET
Resource Constructor(Byte[])
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class > Resource Constructor : Resource Constructor(Byte[])

content
Bytes used to initialize Content.

Glossary Item Box

Constructor used to subsequently encode the provided Stream.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal content() As Byte _
)
Visual Basic (Usage) Copy Code
Dim content() As Byte

Dim instance As New Resource(content)
C#
public Resource(
   byte[] content
)
Managed Extensions for C++
public: Resource(
   byte[]* content
)
C++/CLI
public:
Resource(
   array<byte>^ content
)

Parameters

content
Bytes used to initialize Content.

See Also

Reference

Resource Class
Resource Members
Overload List


Resource Constructor(Byte[],String)

[image]
PowerTCP Mail for .NET
Resource Constructor(Byte[],String)
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class > Resource Constructor : Resource Constructor(Byte[],String)

content
Used to initialize Content.
name
Used to initialize ContentType.Name.

Glossary Item Box

Constructor used to create a new Resource and associate it with existing binary data.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal content() As Byte, _
   ByVal name As String _
)
Visual Basic (Usage) Copy Code
Dim content() As Byte
Dim name As String

Dim instance As New Resource(content, name)
C#
public Resource(
   byte[] content,
   string name
)
Managed Extensions for C++
public: Resource(
   byte[]* content,
   string* name
)
C++/CLI
public:
Resource(
   array<byte>^ content,
   String^ name
)

Parameters

content
Used to initialize Content.
name
Used to initialize ContentType.Name.

Remarks

ContentType.MediaType is set using GetMediaTypeFromExtension.

See Also

Reference

Resource Class
Resource Members
Overload List


Resource Constructor(Stream,String)

[image]
PowerTCP Mail for .NET
Resource Constructor(Stream,String)
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class > Resource Constructor : Resource Constructor(Stream,String)

content
Used to initialize Content. The user is responsible for closing this Stream after use.
name
Used to initialize ContentType.Name. Can be null.

Glossary Item Box

Constructor used to create a new Resource and associate it with existing binary data from a Stream.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal content As Stream, _
   ByVal name As String _
)
Visual Basic (Usage) Copy Code
Dim content As Stream
Dim name As String

Dim instance As New Resource(content, name)
C#
public Resource(
   Stream content,
   string name
)
Managed Extensions for C++
public: Resource(
   Stream* content,
   string* name
)
C++/CLI
public:
Resource(
   Stream^ content,
   String^ name
)

Parameters

content
Used to initialize Content. The user is responsible for closing this Stream after use.
name
Used to initialize ContentType.Name. Can be null.

Remarks

ContentType.MediaType is set using GetMediaTypeFromExtension.

See Also

Reference

Resource Class
Resource Members
Overload List


Resource Class Methods

[image]
PowerTCP Mail for .NET
Resource Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Resource Class

Glossary Item Box

For a list of all members of this type, see Resource members.

Public Methods

 | Name | Description
Public Method | Clear | Overridden. Reinitializes the part to default (empty) values.
Public Method | Clone | Overridden. Creates a deep copy of the Resource part, but a shallow copy of its Content.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content.
Public Method | Dispose | Overloaded. Releases all resources associated with the object. (Inherited from Dart.Mail.Part)
Public Method | GetContentEncodingStream | Overridden. Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.
Public Method | GetContentStream | Gets a Stream that contains decoded byte content from Content.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType.
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Resource Class
Dart.Mail Namespace


Clear Method

[image]
PowerTCP Mail for .NET
Clear Method
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : Clear Method

Glossary Item Box

Reinitializes the part to default (empty) values.

Syntax

Visual Basic (Declaration)
Public Overrides Sub Clear()
Visual Basic (Usage) Copy Code
Dim instance As Resource

instance.Clear()
C#
public override void Clear()
Managed Extensions for C++
public: void Clear(); override
C++/CLI
public:
void Clear(); override

See Also

Reference

Resource Class
Resource Members


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : Clone Method

Glossary Item Box

Creates a deep copy of the Resource part, but a shallow copy of its Content.

Syntax

Visual Basic (Declaration)
Public Overrides Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value As Object

value = instance.Clone()
C#
public override object Clone()
Managed Extensions for C++
public: Object* Clone(); override
C++/CLI
public:
Object^ Clone(); override

Return Value

A Resource

Remarks

Note: Calling Dispose() on the original or cloned part will dispose of the data that the original and clone reference.

See Also

Reference

Resource Class
Resource Members


ContentToArray Method

[image]
PowerTCP Mail for .NET
ContentToArray Method
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : ContentToArray Method

Glossary Item Box

Gets a byte[] that contains decoded byte content.

Syntax

Visual Basic (Declaration)
Public Function ContentToArray() As Byte()
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value() As Byte

value = instance.ContentToArray()
C#
public byte[] ContentToArray()
Managed Extensions for C++
public: byte[]* ContentToArray();
C++/CLI
public:
array<byte>^ ContentToArray();

Return Value

A byte[] containing decoded content.

See Also

Reference

Resource Class
Resource Members


GetContentEncodingStream Method

[image]
PowerTCP Mail for .NET
GetContentEncodingStream Method
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : GetContentEncodingStream Method

Glossary Item Box

Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetContentEncodingStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value As Stream

value = instance.GetContentEncodingStream()
C#
public override Stream GetContentEncodingStream()
Managed Extensions for C++
public: Stream* GetContentEncodingStream(); override
C++/CLI
public:
Stream^ GetContentEncodingStream(); override

Return Value

A System.IO.Stream that encodes/decodes.

Remarks

Acts on the body content only (not the Headers).

See Also

Reference

Resource Class
Resource Members


GetContentStream Method

[image]
PowerTCP Mail for .NET
GetContentStream Method
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : GetContentStream Method

Glossary Item Box

Gets a Stream that contains decoded byte content from Content.

Syntax

Visual Basic (Declaration)
Public Overridable Function GetContentStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value As Stream

value = instance.GetContentStream()
C#
public virtual Stream GetContentStream()
Managed Extensions for C++
public: virtual Stream* GetContentStream();
C++/CLI
public:
virtual Stream^ GetContentStream();

See Also

Reference

Resource Class
Resource Members


GetMediaTypeFromExtension Method

[image]
PowerTCP Mail for .NET
GetMediaTypeFromExtension Method
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : GetMediaTypeFromExtension Method

path
A file name or path.

Glossary Item Box

Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType.

Syntax

Visual Basic (Declaration)
Public Function GetMediaTypeFromExtension( _
   ByVal path As String _
) As String
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim path As String
Dim value As String

value = instance.GetMediaTypeFromExtension(path)
C#
public string GetMediaTypeFromExtension(
   string path
)
Managed Extensions for C++
public: string* GetMediaTypeFromExtension(
   string* path
)
C++/CLI
public:
String^ GetMediaTypeFromExtension(
   String^ path
)

Parameters

path
A file name or path.

Return Value

A string suitable for use as ContentType.MediaType.

See Also

Reference

Resource Class
Resource Members


Resource Class Properties

[image]
PowerTCP Mail for .NET
Resource Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Resource Class

Glossary Item Box

For a list of all members of this type, see Resource members.

Public Properties

 | Name | Description
Public Property | Content | Gets or sets the decoded Content of the part.
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part.
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part.
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Headers | Provides a Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part.
Top

See Also

Reference

Resource Class
Dart.Mail Namespace


Content Property

[image]
PowerTCP Mail for .NET
Content Property
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : Content Property

Glossary Item Box

Gets or sets the decoded Content of the part.

Syntax

Visual Basic (Declaration)
Public Property Content As Byte()
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value() As Byte

instance.Content = value

value = instance.Content
C#
public byte[] Content {get; set;}
Managed Extensions for C++
public: __property byte[]* get_Content();
public: __property void set_Content(
   byte[]* value
);
C++/CLI
public:
property array<byte>^ Content {
   array<byte>^ get();
   void set (    array<byte>^ value);
}

See Also

Reference

Resource Class
Resource Members


ContentDisposition Property

[image]
PowerTCP Mail for .NET
ContentDisposition Property
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : ContentDisposition Property

Glossary Item Box

Gets or sets the ContentDisposition values associated with this part.

Syntax

Visual Basic (Declaration)
Public Property ContentDisposition As ContentDisposition
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value As ContentDisposition

instance.ContentDisposition = value

value = instance.ContentDisposition
C#
public ContentDisposition ContentDisposition {get; set;}
Managed Extensions for C++
public: __property ContentDisposition* get_ContentDisposition();
public: __property void set_ContentDisposition(
   ContentDisposition* value
);
C++/CLI
public:
property ContentDisposition^ ContentDisposition {
   ContentDisposition^ get();
   void set (    ContentDisposition^ value);
}

Remarks

A null value indicates the "Content-Disposition" header field is not used.

See Also

Reference

Resource Class
Resource Members


ContentId Property

[image]
PowerTCP Mail for .NET
ContentId Property
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : ContentId Property

Glossary Item Box

Links this resource to a root html part within a "multipart/related" part.

Syntax

Visual Basic (Declaration)
Public Property ContentId As String
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value As String

instance.ContentId = value

value = instance.ContentId
C#
public string ContentId {get; set;}
Managed Extensions for C++
public: __property string* get_ContentId();
public: __property void set_ContentId(
   string* value
);
C++/CLI
public:
property String^ ContentId {
   String^ get();
   void set (    String^ value);
}

See Also

Reference

Resource Class
Resource Members


Length Property

[image]
PowerTCP Mail for .NET
Length Property
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : Length Property

Glossary Item Box

Returns the approximate Length of the encoded part.

Syntax

Visual Basic (Declaration)
Public Overrides ReadOnly Property Length As Long
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value As Long

value = instance.Length
C#
public override long Length {get;}
Managed Extensions for C++
public: __property long get_Length() override;
C++/CLI
public:
property int64 Length {
   int64 get() override;
}

See Also

Reference

Resource Class
Resource Members


TransferEncoding Property

[image]
PowerTCP Mail for .NET
TransferEncoding Property
See Also Send comments on this topic
Dart.Mail Namespace > Resource Class : TransferEncoding Property

Glossary Item Box

Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part.

Syntax

Visual Basic (Declaration)
Public Property TransferEncoding As TransferEncoding
Visual Basic (Usage) Copy Code
Dim instance As Resource
Dim value As TransferEncoding

instance.TransferEncoding = value

value = instance.TransferEncoding
C#
public TransferEncoding TransferEncoding {get; set;}
Managed Extensions for C++
public: __property TransferEncoding get_TransferEncoding();
public: __property void set_TransferEncoding(
   TransferEncoding value
);
C++/CLI
public:
property TransferEncoding TransferEncoding {
   TransferEncoding get();
   void set (    TransferEncoding value);
}

See Also

Reference

Resource Class
Resource Members


Security Class

[image]
PowerTCP Mail for .NET
Security Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Security Class

Glossary Item Box

Holds the configuration used to establish an SSL session.

Object Model

Security Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class Security
Visual Basic (Usage) Copy Code
Dim instance As Security
C#
[Serializable()]
public class Security
Managed Extensions for C++
[Serializable()]
public __gc class Security
C++/CLI
[Serializable()]
public ref class Security

Inheritance Hierarchy

System.Object
Dart.Mail.Security
Dart.Mail.ClientSecurity

See Also

Reference

Security Members
Dart.Mail Namespace


Security Class Members

[image]
PowerTCP Mail for .NET
Security Class Members
See Also Fields Properties Send comments on this topic
Dart.Mail Namespace : Security Class

Glossary Item Box

The following tables list the members exposed by Security.

Public Constructors

 | Name | Description
Public Constructor | Security Constructor | The default constructor for Security
Top

Public Fields

 | Name | Description
Public Field | ValidationCallback | The delegate that executes after the server provides its certificate to the client.
Top

Public Properties

 | Name | Description
Public Property | CheckCertificateRevocation | Indicates whether the certificate revocation list is checked during authentication.
Public Property | Protocols | Gets or sets the SSLProtocols available.
Top

See Also

Reference

Security Class
Dart.Mail Namespace


Security Constructor

[image]
PowerTCP Mail for .NET
Security Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Security Class : Security Constructor

Glossary Item Box

The default constructor for Security

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Security()
C#
public Security()
Managed Extensions for C++
public: Security();
C++/CLI
public:
Security();

See Also

Reference

Security Class
Security Members


Security Class Properties

[image]
PowerTCP Mail for .NET
Security Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Security Class

Glossary Item Box

For a list of all members of this type, see Security members.

Public Properties

 | Name | Description
Public Property | CheckCertificateRevocation | Indicates whether the certificate revocation list is checked during authentication.
Public Property | Protocols | Gets or sets the SSLProtocols available.
Top

See Also

Reference

Security Class
Dart.Mail Namespace


CheckCertificateRevocation Property

[image]
PowerTCP Mail for .NET
CheckCertificateRevocation Property
See Also Send comments on this topic
Dart.Mail Namespace > Security Class : CheckCertificateRevocation Property

Glossary Item Box

Indicates whether the certificate revocation list is checked during authentication.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property CheckCertificateRevocation As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Security
Dim value As Boolean

instance.CheckCertificateRevocation = value

value = instance.CheckCertificateRevocation
C#
[DefaultValue()]
public bool CheckCertificateRevocation {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_CheckCertificateRevocation();
public: __property void set_CheckCertificateRevocation(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool CheckCertificateRevocation {
   bool get();
   void set (    bool value);
}

See Also

Reference

Security Class
Security Members


Protocols Property

[image]
PowerTCP Mail for .NET
Protocols Property
See Also Send comments on this topic
Dart.Mail Namespace > Security Class : Protocols Property

Glossary Item Box

Gets or sets the SSLProtocols available.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property Protocols As SslProtocols
Visual Basic (Usage) Copy Code
Dim instance As Security
Dim value As SslProtocols

instance.Protocols = value

value = instance.Protocols
C#
[DefaultValue()]
public SslProtocols Protocols {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property SslProtocols get_Protocols();
public: __property void set_Protocols(
   SslProtocols value
);
C++/CLI
[DefaultValue()]
public:
property SslProtocols Protocols {
   SslProtocols get();
   void set (    SslProtocols value);
}

See Also

Reference

Security Class
Security Members


Security Class Fields

[image]
PowerTCP Mail for .NET
Security Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : Security Class

Glossary Item Box

For a list of all members of this type, see Security members.

Public Fields

 | Name | Description
Public Field | ValidationCallback | The delegate that executes after the server provides its certificate to the client.
Top

See Also

Reference

Security Class
Dart.Mail Namespace


ValidationCallback Field

[image]
PowerTCP Mail for .NET
ValidationCallback Field
See Also Send comments on this topic
Dart.Mail Namespace > Security Class : ValidationCallback Field

Glossary Item Box

The delegate that executes after the server provides its certificate to the client.

Syntax

Visual Basic (Declaration)
Public ValidationCallback As RemoteCertificateValidationCallback
Visual Basic (Usage) Copy Code
Dim instance As Security
Dim value As RemoteCertificateValidationCallback

value = instance.ValidationCallback

instance.ValidationCallback = value
C#
public RemoteCertificateValidationCallback ValidationCallback
Managed Extensions for C++
public: RemoteCertificateValidationCallback* ValidationCallback
C++/CLI
public:
RemoteCertificateValidationCallback^ ValidationCallback

See Also

Reference

Security Class
Security Members


Segment Class

[image]
PowerTCP Mail for .NET
Segment Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Segment Class

Glossary Item Box

Used to describe a byte[] segment that holds data.

Object Model

Segment Class

Syntax

Visual Basic (Declaration)
Public Class Segment
Visual Basic (Usage) Copy Code
Dim instance As Segment
C#
public class Segment
Managed Extensions for C++
public __gc class Segment
C++/CLI
public ref class Segment

Inheritance Hierarchy

System.Object
Dart.Mail.Segment
Dart.Mail.Data

See Also

Reference

Segment Members
Dart.Mail Namespace


Segment Class Members

[image]
PowerTCP Mail for .NET
Segment Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : Segment Class

Glossary Item Box

The following tables list the members exposed by Segment.

Public Constructors

 | Name | Description
Public Constructor | Segment Constructor | Used to create a Segment object that holds a buffer of data.
Top

Public Properties

 | Name | Description
Public Property | Buffer | Gets the buffer that holds data.
Public Property | Count | Byte count of data.
Public Property | Offset | The offset into the buffer where the data starts.
Top

See Also

Reference

Segment Class
Dart.Mail Namespace


Segment Constructor

[image]
PowerTCP Mail for .NET
Segment Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Segment Class : Segment Constructor

buffer
Byte[] containing data.
offset
Offset into the buffer where the data starts.
count
Byte count of data.

Glossary Item Box

Used to create a Segment object that holds a buffer of data.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer _
)
Visual Basic (Usage) Copy Code
Dim buffer() As Byte
Dim offset As Integer
Dim count As Integer

Dim instance As New Segment(buffer, offset, count)
C#
public Segment(
   byte[] buffer,
   int offset,
   int count
)
Managed Extensions for C++
public: Segment(
   byte[]* buffer,
   int offset,
   int count
)
C++/CLI
public:
Segment(
   array<byte>^ buffer,
   int offset,
   int count
)

Parameters

buffer
Byte[] containing data.
offset
Offset into the buffer where the data starts.
count
Byte count of data.

See Also

Reference

Segment Class
Segment Members


Segment Class Properties

[image]
PowerTCP Mail for .NET
Segment Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Segment Class

Glossary Item Box

For a list of all members of this type, see Segment members.

Public Properties

 | Name | Description
Public Property | Buffer | Gets the buffer that holds data.
Public Property | Count | Byte count of data.
Public Property | Offset | The offset into the buffer where the data starts.
Top

See Also

Reference

Segment Class
Dart.Mail Namespace


Buffer Property

[image]
PowerTCP Mail for .NET
Buffer Property
See Also Send comments on this topic
Dart.Mail Namespace > Segment Class : Buffer Property

Glossary Item Box

Gets the buffer that holds data.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Buffer As Byte()
Visual Basic (Usage) Copy Code
Dim instance As Segment
Dim value() As Byte

value = instance.Buffer
C#
public byte[] Buffer {get;}
Managed Extensions for C++
public: __property byte[]* get_Buffer();
C++/CLI
public:
property array<byte>^ Buffer {
   array<byte>^ get();
}

See Also

Reference

Segment Class
Segment Members


Count Property

[image]
PowerTCP Mail for .NET
Count Property
See Also Send comments on this topic
Dart.Mail Namespace > Segment Class : Count Property

Glossary Item Box

Byte count of data.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Count As Integer
Visual Basic (Usage) Copy Code
Dim instance As Segment
Dim value As Integer

value = instance.Count
C#
public int Count {get;}
Managed Extensions for C++
public: __property int get_Count();
C++/CLI
public:
property int Count {
   int get();
}

See Also

Reference

Segment Class
Segment Members


Offset Property

[image]
PowerTCP Mail for .NET
Offset Property
See Also Send comments on this topic
Dart.Mail Namespace > Segment Class : Offset Property

Glossary Item Box

The offset into the buffer where the data starts.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Offset As Integer
Visual Basic (Usage) Copy Code
Dim instance As Segment
Dim value As Integer

value = instance.Offset
C#
public int Offset {get;}
Managed Extensions for C++
public: __property int get_Offset();
C++/CLI
public:
property int Offset {
   int get();
}

See Also

Reference

Segment Class
Segment Members


Session Class

[image]
PowerTCP Mail for .NET
Session Class
Members See Also Send comments on this topic
Dart.Mail Namespace : Session Class

Glossary Item Box

Holds the configuration common to UDP and TCP.

Object Model

Session ClassIPEndPoint ClassIPEndPoint Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class Session
Visual Basic (Usage) Copy Code
Dim instance As Session
C#
[Serializable()]
public class Session
Managed Extensions for C++
[Serializable()]
public __gc class Session
C++/CLI
[Serializable()]
public ref class Session

Inheritance Hierarchy

System.Object
Dart.Mail.Session
Dart.Mail.TcpSession

See Also

Reference

Session Members
Dart.Mail Namespace


Session Class Members

[image]
PowerTCP Mail for .NET
Session Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : Session Class

Glossary Item Box

The following tables list the members exposed by Session.

Public Constructors

 | Name | Description
Public Constructor | Session Constructor | Overloaded.
Top

Public Properties

 | Name | Description
Public Property | LocalEndPoint | EndPoint to bind to locally.
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to.
Top

See Also

Reference

Session Class
Dart.Mail Namespace


Session Constructor

[image]
PowerTCP Mail for .NET
Session Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Session Class : Session Constructor

Glossary Item Box

Overload List

Overload | Description
Session Constructor() | Default constructor for Session.
Session Constructor(IPEndPoint) | Constructor for Session with a Remote IPEndPoint parameter.

See Also

Reference

Session Class
Session Members


Session Constructor()

[image]
PowerTCP Mail for .NET
Session Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > Session Class > Session Constructor : Session Constructor()

Glossary Item Box

Default constructor for Session.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Session()
C#
public Session()
Managed Extensions for C++
public: Session();
C++/CLI
public:
Session();

See Also

Reference

Session Class
Session Members
Overload List


Session Constructor(IPEndPoint)

[image]
PowerTCP Mail for .NET
Session Constructor(IPEndPoint)
See Also Send comments on this topic
Dart.Mail Namespace > Session Class > Session Constructor : Session Constructor(IPEndPoint)

remoteEP
The remote IPEndPoint to connect to.

Glossary Item Box

Constructor for Session with a Remote IPEndPoint parameter.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal remoteEP As IPEndPoint _
)
Visual Basic (Usage) Copy Code
Dim remoteEP As IPEndPoint

Dim instance As New Session(remoteEP)
C#
public Session(
   IPEndPoint remoteEP
)
Managed Extensions for C++
public: Session(
   IPEndPoint* remoteEP
)
C++/CLI
public:
Session(
   IPEndPoint^ remoteEP
)

Parameters

remoteEP
The remote IPEndPoint to connect to.

See Also

Reference

Session Class
Session Members
Overload List


Session Class Properties

[image]
PowerTCP Mail for .NET
Session Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Session Class

Glossary Item Box

For a list of all members of this type, see Session members.

Public Properties

 | Name | Description
Public Property | LocalEndPoint | EndPoint to bind to locally.
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to.
Top

See Also

Reference

Session Class
Dart.Mail Namespace


LocalEndPoint Property

[image]
PowerTCP Mail for .NET
LocalEndPoint Property
See Also Send comments on this topic
Dart.Mail Namespace > Session Class : LocalEndPoint Property

Glossary Item Box

EndPoint to bind to locally.

Syntax

Visual Basic (Declaration)
Public Property LocalEndPoint As IPEndPoint
Visual Basic (Usage) Copy Code
Dim instance As Session
Dim value As IPEndPoint

instance.LocalEndPoint = value

value = instance.LocalEndPoint
C#
public IPEndPoint LocalEndPoint {get; set;}
Managed Extensions for C++
public: __property IPEndPoint* get_LocalEndPoint();
public: __property void set_LocalEndPoint(
   IPEndPoint* value
);
C++/CLI
public:
property IPEndPoint^ LocalEndPoint {
   IPEndPoint^ get();
   void set (    IPEndPoint^ value);
}

Remarks

Use this property to control the use of IPv4/IPv6, the IP interface to bind to (for multi-homed hosts), and the port or port-range to use. Defaults to AddressFamily.InterNetworkV4, IPAddress.Any, and a port selected by the system (ephemeral port 0).

To use AddressFamily.InterNetworkV6, create a new IPEndPoint that specifies this AddressFamily. A Socket will be created that can connect to both IPv4 and IPv6 hosts. This is called a "dual stack", allowing clients to connect to both IPv4 and IPv6 servers, and allowing servers to accept connections from both IPv4 and IPv6 clients.

If IPEndPoint.Any is not desired, specify the hostname or address in the constructor.

If a random ephemeral port is not desired, specify the port or range in the constructor.

See Also

Reference

Session Class
Session Members


RemoteEndPoint Property

[image]
PowerTCP Mail for .NET
RemoteEndPoint Property
See Also Send comments on this topic
Dart.Mail Namespace > Session Class : RemoteEndPoint Property

Glossary Item Box

EndPoint of the remote host to connect to.

Syntax

Visual Basic (Declaration)
Public Property RemoteEndPoint As IPEndPoint
Visual Basic (Usage) Copy Code
Dim instance As Session
Dim value As IPEndPoint

instance.RemoteEndPoint = value

value = instance.RemoteEndPoint
C#
public IPEndPoint RemoteEndPoint {get; set;}
Managed Extensions for C++
public: __property IPEndPoint* get_RemoteEndPoint();
public: __property void set_RemoteEndPoint(
   IPEndPoint* value
);
C++/CLI
public:
property IPEndPoint^ RemoteEndPoint {
   IPEndPoint^ get();
   void set (    IPEndPoint^ value);
}

See Also

Reference

Session Class
Session Members


Smtp Class

[image]
PowerTCP Mail for .NET
Smtp Class
Members Example See Also Send comments on this topic
Dart.Mail Namespace : Smtp Class

Glossary Item Box

Integrates Simple Mail Transfer Protocol (SMTP) functionality into any .NET application, allowing applications to easily send Internet mail.

Object Model

Smtp ClassTcpBase ClassDeliveryStatusNotification ClassSmtpSession Class

Syntax

Visual Basic (Declaration)
Public Class Smtp
   Inherits MailBase
Visual Basic (Usage) Copy Code
Dim instance As Smtp
C#
public class Smtp : MailBase
Managed Extensions for C++
public __gc class Smtp : public MailBase
C++/CLI
public ref class Smtp : public MailBase

Remarks

The Smtp component sends Internet mail. It is feature-rich and flexible, and includes functionality not found in the .NET Platform such as multiple authentication techniques, proxy support, Stream support, access to the TCP connection, debugging features and more.

Using the Smtp Component

A short description of common usage follows. See the "Code Examples" topic for examples in C# and VB.

Session Management: Authentication is automatic. Close terminates the connection.

Sends Basic Mail: Send(String,String,String,String) provides a high-level method to send mail with one line of code.

Sends Advanced Mail: Send(MailMessage) encodes and sends the referenced MailMessage, allowing unprecedented ability to create any email message, no matter how complex the structure!

Sends Encoded Mail: Send(Stream,String,String) sends previously encoded email.

"On-the-fly" encoding: All MailMessage parts are encoded on-the-fly and streamed to the socket, minimizing the memory/disk footprint.

Displaying Progress: Progress provides progress updates while uploading.

Viewing SMTP Protocol Communications: The Smtp.Connection.Log event provides access to all commands and data sent over the TCP connection.

Control connection: Connection exposes the TCP connection, allowing access to low-level properties and methods. Can be used to view TCP-level properties, such as the local and remote IP address.

Sending commands: Any command (including proprietary commands) can be sent/received using Connection.Write() and Connection.Read().

Example

Uses the Smtp component to send a text message with an attachment.
C# Copy Code
private void sendMail(object sender)
{
    //Create message to send
    MailMessage message = new MailMessage();
    message.To = toAddress;
    message.From = fromAddress;
    message.Subject = "File Attached";
    message.Text = "Please see the attached file.";

    //Add the attachment
    message.Attachments.Add(new Attachment(Application.StartupPath + "\\myImage.jpg"));

    //Set session parameters
    smtp1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myMailServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send message
    smtp1.Send(message);

    //Logout gracefully
    smtp1.Close();
}

private void smtp1_Progress(object sender, SmtpProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub sendMail(ByVal sender As Object)
    'Create message to send
    Dim message As New MailMessage()
    message.To = toAddress
    message.From = fromAddress
    message.Subject = "File Attached"
    message.Text = "Please see the attached file."

    'Add the attachment
    message.Attachments.Add(New Attachment(Application.StartupPath & "\myImage.jpg"))

    'Set session parameters
    smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myMailServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send message
    smtp1.Send(message)

    'Logout gracefully
    smtp1.Close()
End Sub

Private Sub smtp1_Progress(ByVal sender As Object, ByVal e As SmtpProgressEventArgs) Handles smtp1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

Inheritance Hierarchy

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.Mail.ComponentBase
Dart.Mail.MailBase
Dart.Mail.Smtp

See Also

Reference

Smtp Members
Dart.Mail Namespace


Smtp Class Members

[image]
PowerTCP Mail for .NET
Smtp Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : Smtp Class

Glossary Item Box

The following tables list the members exposed by Smtp.

Public Constructors

 | Name | Description
Public Constructor | Smtp Constructor | Initializes a new instance of the Smtp component.
Top

Public Properties

 | Name | Description
Public Property | AutoPipeline | Gets or sets a value enabling command pipelining if the server supports it.
Public Property | AutoSize | Gets or sets a value indicating if the server will be asked if the message is too large before sending.
Public Property | Capabilities | Gets a List of strings representing the capabilities of the server. (Inherited from Dart.Mail.MailBase)
Public Property | Connection | TCP connection used for server communications.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | DeliveryStatusNotification | Gets or sets the DeliveryStatusNotification object that specifies Delivery Status Notification.
Public Property | DnsServerTimeout | Gets or sets the amount of time in milliseconds to wait for a response from a DNS server.
Public Property | Encoding | Specifies the character encoding to be used by the component. (Inherited from Dart.Mail.MailBase)
Public Property | HelloName | Gets or sets the hostname presented to the server during the greeting.
Public Property | SendDirectToMx | When true, Send methods deliver mail directly to each recipient's mail exchange (MX) server. Defaults to false.
Public Property | ServerGreeting | Gets the greeting received after connecting to the server. (Inherited from Dart.Mail.MailBase)
Public Property | Session | Specifies connection, authentication and behavior configuration.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

Public Methods

 | Name | Description
Public Method | Authenticate | Authenticate the client using parameters in Smtp.Session.
Public Method | Close | Cease all activity and gracefully close the control connection.
Public Method | Connect | Connect to an SMTP server using Session parameters. Any existing connection is aborted.
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
static (Shared in Visual Basic) | GetDefaultPort | Returns the port normally used for the supplied MailSession configuration.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | Send | Overloaded. Send a basic text email.
Public Method | Start | Start a worker thread and execute the specified delegate. (Inherited from Dart.Mail.MailBase)
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnProgress | Raises the Progress event.
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | Progress | Raised repeatedly while an email message is sent.
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Smtp Class
Dart.Mail Namespace


Smtp Constructor

[image]
PowerTCP Mail for .NET
Smtp Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : Smtp Constructor

Glossary Item Box

Initializes a new instance of the Smtp component.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New Smtp()
C#
public Smtp()
Managed Extensions for C++
public: Smtp();
C++/CLI
public:
Smtp();

See Also

Reference

Smtp Class
Smtp Members


Smtp Class Methods

[image]
PowerTCP Mail for .NET
Smtp Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Smtp Class

Glossary Item Box

For a list of all members of this type, see Smtp members.

Public Methods

 | Name | Description
Public Method | Authenticate | Authenticate the client using parameters in Smtp.Session.
Public Method | Close | Cease all activity and gracefully close the control connection.
Public Method | Connect | Connect to an SMTP server using Session parameters. Any existing connection is aborted.
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Releases all resources associated with the object.
static (Shared in Visual Basic) | GetDefaultPort | Returns the port normally used for the supplied MailSession configuration.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | Send | Overloaded. Send a basic text email.
Public Method | Start | Start a worker thread and execute the specified delegate. (Inherited from Dart.Mail.MailBase)
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnProgress | Raises the Progress event.
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Smtp Class
Dart.Mail Namespace


Authenticate Method

[image]
PowerTCP Mail for .NET
Authenticate Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Smtp Class : Authenticate Method

Glossary Item Box

Authenticate the client using parameters in Smtp.Session.

Syntax

Visual Basic (Declaration)
Public Sub Authenticate()
Visual Basic (Usage) Copy Code
Dim instance As Smtp

instance.Authenticate()
C#
public void Authenticate()
Managed Extensions for C++
public: void Authenticate();
C++/CLI
public:
void Authenticate();

Remarks

SSL security is negotiated if Session.Security.Encrypt == Encrypt.Explicit.

Example

This example demonstrates connecting to an Smtp server, with options for encryption (Explicit/Implicit), and authenticating the user.
C# Copy Code
using System.Security.Cryptography.X509Certificates;
using System.Security.Authentication;
using System.Net.Security;

/// <summary>
/// Connects to an Smtp server, optionally using encryption (Explicit/Implicit), and authenticates the user.
/// </summary>
/// <param name="mySmtp">The Smtp instance to connect and authenticate</param>
/// <param name="hostNameOrAddress">The server's hostname or IP address</param>
/// <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
private void ConnectAndAuthenticate(Smtp mySmtp, string hostNameOrAddress, Authentication auth, string username, string password, Encrypt encryption)
{
    if (encryption != Encrypt.None)
    {
        //Set the method of encryption - Implicit/Explicit
        mySmtp.Session.Security.Encrypt = encryption;

        //Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        //TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        mySmtp.Session.Security.Protocols = SslProtocols.Tls | SslProtocols.Ssl3;

        //Specify the server certificate validation callback
        mySmtp.Session.Security.ValidationCallback = remoteCertificateValidation;
    }

    //Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    //GetDefaultPort() returns the common port used for the security configuration.
    mySmtp.Session.RemoteEndPoint = new IPEndPoint(hostNameOrAddress, Pop.GetDefaultPort(mySmtp.Session));

    //Connect to the server.
    mySmtp.Connect();

    //Authenticate the user.
    mySmtp.Session.Username = username;
    mySmtp.Session.Password = password;
    mySmtp.Session.Authentication = auth;
    mySmtp.Authenticate();
}

private bool remoteCertificateValidation(Object sender, X509Certificate remoteCertificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    //the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    return true;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Authentication
Imports System.Net.Security

''' <summary>
''' Connects to an Smtp server, optionally using encryption (Explicit/Implicit), and authenticates the user.
''' </summary>
''' <param name="mySmtp">The Smtp instance to connect and authenticate</param>
''' <param name="hostNameOrAddress">The server's hostname or IP address</param>
''' <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
''' <param name="username">Username</param>
''' <param name="password">Password</param>
''' <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
Private Sub ConnectAndAuthenticate(ByVal mySmtp As Smtp, ByVal hostNameOrAddress As String, ByVal auth As Authentication, ByVal username As String, ByVal password As String, ByVal encryption As Encrypt)
    If encryption <> Encrypt.None Then
        'Set the method of encryption - Implicit/Explicit
        mySmtp.Session.Security.Encrypt = encryption

        'Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        'TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        mySmtp.Session.Security.Protocols = SslProtocols.Tls Or SslProtocols.Ssl3

        'Specify the server certificate validation callback
        mySmtp.Session.Security.ValidationCallback = AddressOf remoteCertificateValidation
    End If

    'Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    'GetDefaultPort() returns the common port used for the security configuration.
    mySmtp.Session.RemoteEndPoint = New IPEndPoint(hostNameOrAddress, Pop.GetDefaultPort(mySmtp.Session))

    'Connect to the server.
    mySmtp.Connect()

    'Authenticate the user.
    mySmtp.Session.Username = username
    mySmtp.Session.Password = password
    mySmtp.Session.Authentication = auth
    mySmtp.Authenticate()
End Sub

Private Function remoteCertificateValidation(ByVal sender As Object, ByVal remoteCertificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    'the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    Return True
End Function

See Also

Reference

Smtp Class
Smtp Members


Close Method

[image]
PowerTCP Mail for .NET
Close Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Smtp Class : Close Method

Glossary Item Box

Cease all activity and gracefully close the control connection.

Syntax

Visual Basic (Declaration)
Public Sub Close()
Visual Basic (Usage) Copy Code
Dim instance As Smtp

instance.Close()
C#
public void Close()
Managed Extensions for C++
public: void Close();
C++/CLI
public:
void Close();

Exceptions

Exception | Description
ProtocolException | Bad SMTP protocol response received from server.
System.Net.Sockets.SocketException | The requested address is not valid in its context.

Remarks

The Send methods automatically log into the SMTP server specified by Session.RemoteEndPoint. Use Close when the connection is no longer needed.

A "QUIT" command is sent to the server and waits until the server has closed the connection.

Use this method to terminate the connection. It differs from the Smtp.Dispose method in that the Smtp.Dispose method is used to abruptly close the connection and release all resources associated with the Smtp component.

Example

Uses the Smtp component to send a text message with an attachment.
C# Copy Code
private void sendMail(object sender)
{
    //Create message to send
    MailMessage message = new MailMessage();
    message.To = toAddress;
    message.From = fromAddress;
    message.Subject = "File Attached";
    message.Text = "Please see the attached file.";

    //Add the attachment
    message.Attachments.Add(new Attachment(Application.StartupPath + "\\myImage.jpg"));

    //Set session parameters
    smtp1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myMailServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send message
    smtp1.Send(message);

    //Logout gracefully
    smtp1.Close();
}

private void smtp1_Progress(object sender, SmtpProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub sendMail(ByVal sender As Object)
    'Create message to send
    Dim message As New MailMessage()
    message.To = toAddress
    message.From = fromAddress
    message.Subject = "File Attached"
    message.Text = "Please see the attached file."

    'Add the attachment
    message.Attachments.Add(New Attachment(Application.StartupPath & "\myImage.jpg"))

    'Set session parameters
    smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myMailServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send message
    smtp1.Send(message)

    'Logout gracefully
    smtp1.Close()
End Sub

Private Sub smtp1_Progress(ByVal sender As Object, ByVal e As SmtpProgressEventArgs) Handles smtp1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Smtp Class
Smtp Members


Connect Method

[image]
PowerTCP Mail for .NET
Connect Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Smtp Class : Connect Method

Glossary Item Box

Connect to an SMTP server using Session parameters. Any existing connection is aborted.

Syntax

Visual Basic (Declaration)
Public Sub Connect()
Visual Basic (Usage) Copy Code
Dim instance As Smtp

instance.Connect()
C#
public void Connect()
Managed Extensions for C++
public: void Connect();
C++/CLI
public:
void Connect();

Remarks

SSL encryption is negotiated if Session.Security.Encrypt == Encrypt.Implicit.

Smtp.Capabilities is populated after connecting.

If Session.RemoteEndPoint.Port is 0, the default port for the current Session configuration will be used.

Authenticate is normally used after this method. If not, it is up to the application to send any necessary authentication commands to the server.

Example

This example demonstrates connecting to an Smtp server, with options for encryption (Explicit/Implicit), and authenticating the user.
C# Copy Code
using System.Security.Cryptography.X509Certificates;
using System.Security.Authentication;
using System.Net.Security;

/// <summary>
/// Connects to an Smtp server, optionally using encryption (Explicit/Implicit), and authenticates the user.
/// </summary>
/// <param name="mySmtp">The Smtp instance to connect and authenticate</param>
/// <param name="hostNameOrAddress">The server's hostname or IP address</param>
/// <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
private void ConnectAndAuthenticate(Smtp mySmtp, string hostNameOrAddress, Authentication auth, string username, string password, Encrypt encryption)
{
    if (encryption != Encrypt.None)
    {
        //Set the method of encryption - Implicit/Explicit
        mySmtp.Session.Security.Encrypt = encryption;

        //Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        //TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        mySmtp.Session.Security.Protocols = SslProtocols.Tls | SslProtocols.Ssl3;

        //Specify the server certificate validation callback
        mySmtp.Session.Security.ValidationCallback = remoteCertificateValidation;
    }

    //Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    //GetDefaultPort() returns the common port used for the security configuration.
    mySmtp.Session.RemoteEndPoint = new IPEndPoint(hostNameOrAddress, Pop.GetDefaultPort(mySmtp.Session));

    //Connect to the server.
    mySmtp.Connect();

    //Authenticate the user.
    mySmtp.Session.Username = username;
    mySmtp.Session.Password = password;
    mySmtp.Session.Authentication = auth;
    mySmtp.Authenticate();
}

private bool remoteCertificateValidation(Object sender, X509Certificate remoteCertificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    //the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    return true;
}
Visual Basic Copy Code
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Authentication
Imports System.Net.Security

''' <summary>
''' Connects to an Smtp server, optionally using encryption (Explicit/Implicit), and authenticates the user.
''' </summary>
''' <param name="mySmtp">The Smtp instance to connect and authenticate</param>
''' <param name="hostNameOrAddress">The server's hostname or IP address</param>
''' <param name="auth">Authentication method to use. 'Auto' is suitable for most circumstances.</param>
''' <param name="username">Username</param>
''' <param name="password">Password</param>
''' <param name="encryption">Controls whether SSL/TLS is used, and the implementation. None/Explicit/Implicit.</param>
Private Sub ConnectAndAuthenticate(ByVal mySmtp As Smtp, ByVal hostNameOrAddress As String, ByVal auth As Authentication, ByVal username As String, ByVal password As String, ByVal encryption As Encrypt)
    If encryption <> Encrypt.None Then
        'Set the method of encryption - Implicit/Explicit
        mySmtp.Session.Security.Encrypt = encryption

        'Optionally set the protocols available for SSL/TLS negotiation (defaults to SslProtocols.Default)
        'TLS 1.1/1.2 requires .NET 4.5+. See the SslProtocols MSDN documentation for more information.
        mySmtp.Session.Security.Protocols = SslProtocols.Tls Or SslProtocols.Ssl3

        'Specify the server certificate validation callback
        mySmtp.Session.Security.ValidationCallback = AddressOf remoteCertificateValidation
    End If

    'Set the server address and port. If the server uses a non-standard port, it should be substituted here.
    'GetDefaultPort() returns the common port used for the security configuration.
    mySmtp.Session.RemoteEndPoint = New IPEndPoint(hostNameOrAddress, Pop.GetDefaultPort(mySmtp.Session))

    'Connect to the server.
    mySmtp.Connect()

    'Authenticate the user.
    mySmtp.Session.Username = username
    mySmtp.Session.Password = password
    mySmtp.Session.Authentication = auth
    mySmtp.Authenticate()
End Sub

Private Function remoteCertificateValidation(ByVal sender As Object, ByVal remoteCertificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'For this simple snippet, accept all server certificates. Please see the 'Security' top-level help topics, or
    'the System.Net.Security.RemoteCertificateValidationCallback MSDN documentation, for more information.
    Return True
End Function

See Also

Reference

Smtp Class
Smtp Members


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : Dispose Method

Glossary Item Box

Releases all resources associated with the object.

Overload List

Overload | Description
Dispose(Boolean) | Releases all resources associated with the object.
Dispose() | (Inherited from System.ComponentModel.Component)

See Also

Reference

Smtp Class
Smtp Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Releases all resources associated with the object.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method abruptly aborts the connection and releases all resources.

Dispose should ONLY be used to release all resources used by the object, and the object should not be subsequently used. To gracefully disconnect from the server, use Close before calling this method. The Object cannot be used once Dispose is called.

See Also

Reference

Smtp Class
Smtp Members
Overload List


GetDefaultPort Method

[image]
PowerTCP Mail for .NET
GetDefaultPort Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : GetDefaultPort Method

session
The MailSession to use for determining the port.

Glossary Item Box

Returns the port normally used for the supplied MailSession configuration.

Syntax

Visual Basic (Declaration)
Public Shared Function GetDefaultPort( _
   ByVal session As SmtpSession _
) As Integer
Visual Basic (Usage) Copy Code
Dim session As SmtpSession
Dim value As Integer

value = Smtp.GetDefaultPort(session)
C#
public static int GetDefaultPort(
   SmtpSession session
)
Managed Extensions for C++
public: static int GetDefaultPort(
   SmtpSession* session
)
C++/CLI
public:
static int GetDefaultPort(
   SmtpSession^ session
)

Parameters

session
The MailSession to use for determining the port.

Return Value

The port normally used for the supplied MailSession configuration.

Remarks

Returns 587 (the well-known SMTP submission port) if SmtpSession.UseSubmissionPort is true, and 25 (the well-known SMTP server port) if false. If MailSecurity.Encrypt == Encrypt.Implicit, returns 465 (the well-known secure SMTP port).

Used to initialize Session.RemoteEndPoint.Port if not initialized by the user.

See Also

Reference

Smtp Class
Smtp Members


OnProgress Method

[image]
PowerTCP Mail for .NET
OnProgress Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : OnProgress Method

e
SmtpProgressEventArgs containing event data.

Glossary Item Box

Raises the Progress event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnProgress( _
   ByVal e As SmtpProgressEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim e As SmtpProgressEventArgs

instance.OnProgress(e)
C#
protected virtual void OnProgress(
   SmtpProgressEventArgs e
)
Managed Extensions for C++
protected: virtual void OnProgress(
   SmtpProgressEventArgs* e
)
C++/CLI
protected:
virtual void OnProgress(
   SmtpProgressEventArgs^ e
)

Parameters

e
SmtpProgressEventArgs containing event data.

Remarks

Allows derived classes to handle the event without attaching a delegate. Marshaling to the UI thread is not provided. This is the preferred technique for handling an event in a derived class.

Note to Inheritors: When overriding OnProgress in a derived class, be sure to call the base class OnProgress method so that registered delegates receive the event.

See Also

Reference

Smtp Class
Smtp Members


Send Method

[image]
PowerTCP Mail for .NET
Send Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : Send Method

Glossary Item Box

Send a basic text email.

Overload List

Overload | Description
Send(String,String,String,String) | Send a basic text email.
Send(MailMessage) | Send a MailMessage to a mail server.
Send(MailMessage,String,String) | Send a MailMessage to a mail server using from and recipients to construct the SMTP envelope instead of MailMessage properties.
Send(Stream,String,String) | Send a previously encoded message to a mail server, using from and recipients for constructing the SMTP envelope.
Send(Stream,String,String,TransferEncoding) | Send a previously encoded message to a mail server, using from and recipients for constructing the SMTP envelope.

See Also

Reference

Smtp Class
Smtp Members


Send(String,String,String,String) Method

[image]
PowerTCP Mail for .NET
Send(String,String,String,String) Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class > Send Method : Send(String,String,String,String) Method

toAddress
Recipient of the email.
fromAddress
Sender of the email.
subject
Subject of the email.
text
Body text of the email.

Glossary Item Box

Send a basic text email.

Syntax

Visual Basic (Declaration)
Public Overloads Function Send( _
   ByVal toAddress As String, _
   ByVal fromAddress As String, _
   ByVal subject As String, _
   ByVal text As String _
) As SmtpResult
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim toAddress As String
Dim fromAddress As String
Dim subject As String
Dim text As String
Dim value As SmtpResult

value = instance.Send(toAddress, fromAddress, subject, text)
C#
public SmtpResult Send(
   string toAddress,
   string fromAddress,
   string subject,
   string text
)
Managed Extensions for C++
public: SmtpResult* Send(
   string* toAddress,
   string* fromAddress,
   string* subject,
   string* text
)
C++/CLI
public:
SmtpResult^ Send(
   String^ toAddress,
   String^ fromAddress,
   String^ subject,
   String^ text
)

Parameters

toAddress
Recipient of the email.
fromAddress
Sender of the email.
subject
Subject of the email.
text
Body text of the email.

Return Value

SmtpResult that describes the result.

Exceptions

Exception | Description
ProtocolException | Bad SMTP protocol response received from server.
System.Net.Sockets.SocketException | A socket failure.
System.FormatException | Bad address format.

Remarks

The quickest and easiest way to send a basic text email. An SmtpResult object is returned containing data about the message sent such as the bytes of data sent.

See Also

Reference

Smtp Class
Smtp Members
Overload List


Send(MailMessage) Method

[image]
PowerTCP Mail for .NET
Send(MailMessage) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > Smtp Class > Send Method : Send(MailMessage) Method

message
MailMessage representing an email message.

Glossary Item Box

Send a MailMessage to a mail server.

Syntax

Visual Basic (Declaration)
Public Overloads Function Send( _
   ByVal message As MailMessage _
) As SmtpResult
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim message As MailMessage
Dim value As SmtpResult

value = instance.Send(message)
C#
public SmtpResult Send(
   MailMessage message
)
Managed Extensions for C++
public: SmtpResult* Send(
   MailMessage* message
)
C++/CLI
public:
SmtpResult^ Send(
   MailMessage^ message
)

Parameters

message
MailMessage representing an email message.

Return Value

SmtpResult that describes the result.

Exceptions

Exception | Description
ProtocolException | Bad SMTP protocol response received from server.
System.Net.Sockets.SocketException | A socket failure.
System.InvalidOperationException | MailMessage.BitEncoding is TransferEncoding.EightBit or TransferEncoding.Binary and the server does not advertise 8bit or binary transport.
System.FormatException | Bad address format.

Remarks

This method is used to send most email messages. Initialize a MailMessage as follows:

  • Use MailMessage.MailMessage Constructor to create a new MailMessage.
  • Set the sender, recipients, and subject using From, To, Cc, Bcc, and Subject.
  • Add new Part objects representing MIME parts to Parts.

Alternatively, use Send(String,String,String,String) to send a basic text message, Send(MailMessage,String,String) to specify the mail addresses for the message envelope, or Send(Stream,String,String) to send a previously encoded message (stream).

This method automatically calls Connect and Authenticate if not connected to the server and SendDirectToMx is false.

Example

Uses the Smtp component to send a text message with an attachment.
C# Copy Code
private void sendMail(object sender)
{
    //Create message to send
    MailMessage message = new MailMessage();
    message.To = toAddress;
    message.From = fromAddress;
    message.Subject = "File Attached";
    message.Text = "Please see the attached file.";

    //Add the attachment
    message.Attachments.Add(new Attachment(Application.StartupPath + "\\myImage.jpg"));

    //Set session parameters
    smtp1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myMailServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send message
    smtp1.Send(message);

    //Logout gracefully
    smtp1.Close();
}

private void smtp1_Progress(object sender, SmtpProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub sendMail(ByVal sender As Object)
    'Create message to send
    Dim message As New MailMessage()
    message.To = toAddress
    message.From = fromAddress
    message.Subject = "File Attached"
    message.Text = "Please see the attached file."

    'Add the attachment
    message.Attachments.Add(New Attachment(Application.StartupPath & "\myImage.jpg"))

    'Set session parameters
    smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myMailServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send message
    smtp1.Send(message)

    'Logout gracefully
    smtp1.Close()
End Sub

Private Sub smtp1_Progress(ByVal sender As Object, ByVal e As SmtpProgressEventArgs) Handles smtp1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Smtp Class
Smtp Members
Overload List


Send(MailMessage,String,String) Method

[image]
PowerTCP Mail for .NET
Send(MailMessage,String,String) Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class > Send Method : Send(MailMessage,String,String) Method

message
MailMessage representing an email message.
fromAddress
Address to use for "MAIL FROM". If null, uses From.
recipientAddresses
Addresses to use for "RCPT TO". If null, uses To, Cc, and Bcc.

Glossary Item Box

Send a MailMessage to a mail server using from and recipients to construct the SMTP envelope instead of MailMessage properties.

Syntax

Visual Basic (Declaration)
Public Overloads Function Send( _
   ByVal message As MailMessage, _
   ByVal fromAddress As String, _
   ByVal recipientAddresses As String _
) As SmtpResult
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim message As MailMessage
Dim fromAddress As String
Dim recipientAddresses As String
Dim value As SmtpResult

value = instance.Send(message, fromAddress, recipientAddresses)
C#
public SmtpResult Send(
   MailMessage message,
   string fromAddress,
   string recipientAddresses
)
Managed Extensions for C++
public: SmtpResult* Send(
   MailMessage* message,
   string* fromAddress,
   string* recipientAddresses
)
C++/CLI
public:
SmtpResult^ Send(
   MailMessage^ message,
   String^ fromAddress,
   String^ recipientAddresses
)

Parameters

message
MailMessage representing an email message.
fromAddress
Address to use for "MAIL FROM". If null, uses From.
recipientAddresses
Addresses to use for "RCPT TO". If null, uses To, Cc, and Bcc.

Return Value

SmtpResult that describes the result.

Exceptions

Exception | Description
ProtocolException | Bad SMTP protocol response received from server.
System.Net.Sockets.SocketException | A socket failure.
System.InvalidOperationException | MailMessage.BitEncoding is TransferEncoding.EightBit or TransferEncoding.Binary and the server does not advertise 8bit or binary transport.
System.FormatException | Bad address format.

Remarks

Send(MailMessage) constructs the SMTP envelope with values from From, To, Cc, and Bcc. This method overloads Send(MailMessage) with parameters that specify the "MAIL FROM" and "RCPT TO" SMTP command arguments. Initialize a MailMessage by doing the following:

  • Use MailMessage.MailMessage Constructor to create a new MailMessage.
  • Set the sender, recipients, and subject with From, To, Cc, Bcc, and Subject.
  • Add new Part objects representing MIME parts to Parts.

Alternatively, use Send(String,String,String,String) to send a basic text message, Send(MailMessage) to use the mail addresses in the message, or Send(Stream,String,String) to send a previously encoded message (stream).

If an email address domain name contains non-ASCII characters, IdnMapping.GetAscii(String) will be used to convert it to a valid format.

This method automatically calls Connect and Authenticate if not connected to the server and SendDirectToMx is false.

See Also

Reference

Smtp Class
Smtp Members
Overload List


Send(Stream,String,String) Method

[image]
PowerTCP Mail for .NET
Send(Stream,String,String) Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class > Send Method : Send(Stream,String,String) Method

encodedMessage
Stream containing an ASCII (7-bit) encoded email message.
fromAddress
Address to use for "MAIL FROM". This can be generated using MailAddress.ToString().
recipientAddresses
Addresses to use for "RCPT TO". This can be generated using MailAddressCollection.ToString().

Glossary Item Box

Send a previously encoded message to a mail server, using from and recipients for constructing the SMTP envelope.

Syntax

Visual Basic (Declaration)
Public Overloads Function Send( _
   ByVal encodedMessage As Stream, _
   ByVal fromAddress As String, _
   ByVal recipientAddresses As String _
) As SmtpResult
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim encodedMessage As Stream
Dim fromAddress As String
Dim recipientAddresses As String
Dim value As SmtpResult

value = instance.Send(encodedMessage, fromAddress, recipientAddresses)
C#
public SmtpResult Send(
   Stream encodedMessage,
   string fromAddress,
   string recipientAddresses
)
Managed Extensions for C++
public: SmtpResult* Send(
   Stream* encodedMessage,
   string* fromAddress,
   string* recipientAddresses
)
C++/CLI
public:
SmtpResult^ Send(
   Stream^ encodedMessage,
   String^ fromAddress,
   String^ recipientAddresses
)

Parameters

encodedMessage
Stream containing an ASCII (7-bit) encoded email message.
fromAddress
Address to use for "MAIL FROM". This can be generated using MailAddress.ToString().
recipientAddresses
Addresses to use for "RCPT TO". This can be generated using MailAddressCollection.ToString().

Return Value

An SmtpResult object that describes the sent message.

Exceptions

Exception | Description
ProtocolException | Bad SMTP protocol response received from server.
System.Net.Sockets.SocketException | A socket failure.
System.FormatException | Bad address format.

Remarks

This method is identical to Send(MailMessage,String,String), except the message has already been encoded.

Alternatively, use Send(String,String,String,String) to send a basic text message, Send(MailMessage) to use the mail addresses in the message, or Send(MailMessage,String,String) to send MailMessage using the specified envelope.

If an email address domain name contains non-ASCII characters, System.Globalization.IdnMapping.GetAscii(System.String) will be used to convert it to a valid format.

This method automatically calls Connect and Authenticate if not connected to the server and SendDirectToMx is false.

See Also

Reference

Smtp Class
Smtp Members
Overload List


Send(Stream,String,String,TransferEncoding) Method

[image]
PowerTCP Mail for .NET
Send(Stream,String,String,TransferEncoding) Method
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class > Send Method : Send(Stream,String,String,TransferEncoding) Method

encodedMessage
Stream containing an encoded email message.
fromAddress
Address to use for "MAIL FROM". This can be generated using MailAddress.ToString().
recipientAddresses
Addresses to use for "RCPT TO". This can be generated using MailAddressCollection.ToString().
bitEncoding
Restricted to TransferEncoding.SevenBit, TransferEncoding.EightBit and TransferEncoding.Binary, controls the use of the BODY label when sending an 8-bit encoded message.

Glossary Item Box

Send a previously encoded message to a mail server, using from and recipients for constructing the SMTP envelope.

Syntax

Visual Basic (Declaration)
Public Overloads Function Send( _
   ByVal encodedMessage As Stream, _
   ByVal fromAddress As String, _
   ByVal recipientAddresses As String, _
   ByVal bitEncoding As TransferEncoding _
) As SmtpResult
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim encodedMessage As Stream
Dim fromAddress As String
Dim recipientAddresses As String
Dim bitEncoding As TransferEncoding
Dim value As SmtpResult

value = instance.Send(encodedMessage, fromAddress, recipientAddresses, bitEncoding)
C#
public SmtpResult Send(
   Stream encodedMessage,
   string fromAddress,
   string recipientAddresses,
   TransferEncoding bitEncoding
)
Managed Extensions for C++
public: SmtpResult* Send(
   Stream* encodedMessage,
   string* fromAddress,
   string* recipientAddresses,
   TransferEncoding bitEncoding
)
C++/CLI
public:
SmtpResult^ Send(
   Stream^ encodedMessage,
   String^ fromAddress,
   String^ recipientAddresses,
   TransferEncoding bitEncoding
)

Parameters

encodedMessage
Stream containing an encoded email message.
fromAddress
Address to use for "MAIL FROM". This can be generated using MailAddress.ToString().
recipientAddresses
Addresses to use for "RCPT TO". This can be generated using MailAddressCollection.ToString().
bitEncoding
Restricted to TransferEncoding.SevenBit, TransferEncoding.EightBit and TransferEncoding.Binary, controls the use of the BODY label when sending an 8-bit encoded message.

Return Value

An SmtpResult object that describes the sent message.

Exceptions

Exception | Description
ProtocolException | Bad SMTP protocol response received from server.
System.Net.Sockets.SocketException | A socket failure.
System.InvalidOperationException | The bitEncoding parameter is TransferEncoding.EightBit or TransferEncoding.Binary and the server does not advertise 8bit or binary transport.
System.FormatException | Bad address format.
System.ArgumentException | The bitEncoding parameter is not TransferEncoding.SevenBit, TransferEncoding.EightBit or TransferEncoding.Binary.

Remarks

This method is identical to Send(MailMessage,String,String), except the message has already been encoded.

Alternatively, use Send(String,String,String,String) to send a basic text message, Send(MailMessage) to use the mail addresses in the message, or Send(MailMessage,String,String) to send MailMessage using the specified envelope.

If an email address domain name contains non-ASCII characters, System.Globalization.IdnMapping.GetAscii(System.String) will be used to convert it to a valid format.

This method automatically calls Connect and Authenticate if not connected to the server and SendDirectToMx is false.

See Also

Reference

Smtp Class
Smtp Members
Overload List


Smtp Class Properties

[image]
PowerTCP Mail for .NET
Smtp Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Smtp Class

Glossary Item Box

For a list of all members of this type, see Smtp members.

Public Properties

 | Name | Description
Public Property | AutoPipeline | Gets or sets a value enabling command pipelining if the server supports it.
Public Property | AutoSize | Gets or sets a value indicating if the server will be asked if the message is too large before sending.
Public Property | Capabilities | Gets a List of strings representing the capabilities of the server. (Inherited from Dart.Mail.MailBase)
Public Property | Connection | TCP connection used for server communications.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | DeliveryStatusNotification | Gets or sets the DeliveryStatusNotification object that specifies Delivery Status Notification.
Public Property | DnsServerTimeout | Gets or sets the amount of time in milliseconds to wait for a response from a DNS server.
Public Property | Encoding | Specifies the character encoding to be used by the component. (Inherited from Dart.Mail.MailBase)
Public Property | HelloName | Gets or sets the hostname presented to the server during the greeting.
Public Property | SendDirectToMx | When true, Send methods deliver mail directly to each recipient's mail exchange (MX) server. Defaults to false.
Public Property | ServerGreeting | Gets the greeting received after connecting to the server. (Inherited from Dart.Mail.MailBase)
Public Property | Session | Specifies connection, authentication and behavior configuration.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

See Also

Reference

Smtp Class
Dart.Mail Namespace


AutoPipeline Property

[image]
PowerTCP Mail for .NET
AutoPipeline Property
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : AutoPipeline Property

Glossary Item Box

Gets or sets a value enabling command pipelining if the server supports it.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property AutoPipeline As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim value As Boolean

instance.AutoPipeline = value

value = instance.AutoPipeline
C#
[DefaultValue()]
public bool AutoPipeline {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_AutoPipeline();
public: __property void set_AutoPipeline(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool AutoPipeline {
   bool get();
   void set (    bool value);
}

Property Value

true if the component should send multiple commands without waiting for replies. Defaults to true.

Remarks

Some servers support PIPELINING, which can increase performance by sending multiple commands without waiting for responses. Set this property to false to prevent PIPELINING, which may be desirable under some conditions (for example, a firewall does not handle it correctly).

With version 4.3, this property reflects the value stored in SmtpSession.AutoSize.

See Also

Reference

Smtp Class
Smtp Members


AutoSize Property

[image]
PowerTCP Mail for .NET
AutoSize Property
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : AutoSize Property

Glossary Item Box

Gets or sets a value indicating if the server will be asked if the message is too large before sending.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property AutoSize As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim value As Boolean

instance.AutoSize = value

value = instance.AutoSize
C#
[DefaultValue()]
public bool AutoSize {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_AutoSize();
public: __property void set_AutoSize(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool AutoSize {
   bool get();
   void set (    bool value);
}

Property Value

true if the server should be asked if the message is too large before sending, otherwise false. Defaults to true.

Remarks

The advent of MIME, which introduced the transfer of greater amounts of non-ASCII files, resulted in much larger data load for SMTP servers. The SIZE command was introduced as a way for a server to announce the maximum file size it would accept and for a client to announce the size of data it is about to send. When a client announces the size of the data, the server then has an opportunity to accept or reject the data. If the SMTP server supports the SIZE command, Smtp.AutoSize controls whether or not this announcement is made.

If sending mail using a server that supports the SIZE command, set this value to false if you wish to keep the client from announcing the size of the data that will be sent.

With version 4.3, this property reflects the value stored in SmtpSession.AutoSize.

See Also

Reference

Smtp Class
Smtp Members


Connection Property

[image]
PowerTCP Mail for .NET
Connection Property
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : Connection Property

Glossary Item Box

TCP connection used for server communications.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Connection As TcpBase
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim value As TcpBase

value = instance.Connection
C#
public TcpBase Connection {get;}
Managed Extensions for C++
public: __property TcpBase* get_Connection();
C++/CLI
public:
property TcpBase^ Connection {
   TcpBase^ get();
}

Property Value

TcpBase

See Also

Reference

Smtp Class
Smtp Members


DeliveryStatusNotification Property

[image]
PowerTCP Mail for .NET
DeliveryStatusNotification Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Smtp Class : DeliveryStatusNotification Property

Glossary Item Box

Gets or sets the DeliveryStatusNotification object that specifies Delivery Status Notification.

Syntax

Visual Basic (Declaration)
Public Property DeliveryStatusNotification As DeliveryStatusNotification
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim value As DeliveryStatusNotification

instance.DeliveryStatusNotification = value

value = instance.DeliveryStatusNotification
C#
public DeliveryStatusNotification DeliveryStatusNotification {get; set;}
Managed Extensions for C++
public: __property DeliveryStatusNotification* get_DeliveryStatusNotification();
public: __property void set_DeliveryStatusNotification(
   DeliveryStatusNotification* value
);
C++/CLI
public:
property DeliveryStatusNotification^ DeliveryStatusNotification {
   DeliveryStatusNotification^ get();
   void set (    DeliveryStatusNotification^ value);
}

Example

This example demonstrates sending a message with Delivery Status Notification (DSN).
C# Copy Code
using System.Net.Mail;

private void sendWithDsn()
{
    //Specify a DSN ID to use
    smtp1.DeliveryStatusNotification.EnvelopeID = "ID1234567";

    //Return the entire message instead of the headers
    smtp1.DeliveryStatusNotification.ReturnMessage = true;

    //Send a DSN on failure or delay
    smtp1.DeliveryStatusNotification.Options = DeliveryNotificationOptions.Delay | DeliveryNotificationOptions.OnFailure;

    //Send a message
    smtp1.Session.RemoteEndPoint = new IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;
    smtp1.Send(toAddress, fromAddress, "Test", "Test Message.");
    //Gracefully logout
    smtp1.Close();
}
Visual Basic Copy Code
Imports System.Net.Mail

Private Sub sendWithDsn()
    'Specify a DSN ID to use
    smtp1.DeliveryStatusNotification.EnvelopeID = "ID1234567"

    'Return the entire message instead of the headers
    smtp1.DeliveryStatusNotification.ReturnMessage = True

    'Send a DSN on failure or delay
    smtp1.DeliveryStatusNotification.Options = DeliveryNotificationOptions.Delay Or DeliveryNotificationOptions.OnFailure

    'Send a message
    smtp1.Session.RemoteEndPoint = New IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword
    smtp1.Send(toAddress, fromAddress, "Test", "Test Message.")
    'Gracefully logout
    smtp1.Close()
End Sub

See Also

Reference

Smtp Class
Smtp Members


DnsServerTimeout Property

[image]
PowerTCP Mail for .NET
DnsServerTimeout Property
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : DnsServerTimeout Property

Glossary Item Box

Gets or sets the amount of time in milliseconds to wait for a response from a DNS server.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property DnsServerTimeout As Integer
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim value As Integer

instance.DnsServerTimeout = value

value = instance.DnsServerTimeout
C#
[DefaultValue()]
public int DnsServerTimeout {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_DnsServerTimeout();
public: __property void set_DnsServerTimeout(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int DnsServerTimeout {
   int get();
   void set (    int value);
}

Property Value

An integer specifying the maximum number of milliseconds to wait for responses to DNS requests. Defaults to 3000.

See Also

Reference

Smtp Class
Smtp Members


HelloName Property

[image]
PowerTCP Mail for .NET
HelloName Property
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : HelloName Property

Glossary Item Box

Gets or sets the hostname presented to the server during the greeting.

Syntax

Visual Basic (Declaration)
Public Property HelloName As String
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim value As String

instance.HelloName = value

value = instance.HelloName
C#
public string HelloName {get; set;}
Managed Extensions for C++
public: __property string* get_HelloName();
public: __property void set_HelloName(
   string* value
);
C++/CLI
public:
property String^ HelloName {
   String^ get();
   void set (    String^ value);
}

Property Value

A string value representing the hostname presented to the server during the greeting.

Remarks

The hello command (EHLO or HELO) is sent when communication begins with the mail server. Typically the value presented after HELO includes the domain. GetComputerNameEx() is used to initialize this value to the fully qualified DNS name.

See Also

Reference

Smtp Class
Smtp Members


SendDirectToMx Property

[image]
PowerTCP Mail for .NET
SendDirectToMx Property
See Also Send comments on this topic
Dart.Mail Namespace > Smtp Class : SendDirectToMx Property

Glossary Item Box

When true, Send methods deliver mail directly to each recipient's mail exchange (MX) server. Defaults to false.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property SendDirectToMx As Boolean
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim value As Boolean

instance.SendDirectToMx = value

value = instance.SendDirectToMx
C#
[DefaultValue()]
public bool SendDirectToMx {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_SendDirectToMx();
public: __property void set_SendDirectToMx(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool SendDirectToMx {
   bool get();
   void set (    bool value);
}

Remarks

When true, Recipients on the same domain are grouped together so that a single internal connection can be used for each group.

See Also

Reference

Smtp Class
Smtp Members


Session Property

[image]
PowerTCP Mail for .NET
Session Property
See Also Example Send comments on this topic
Dart.Mail Namespace > Smtp Class : Session Property

Glossary Item Box

Specifies connection, authentication and behavior configuration.

Syntax

Visual Basic (Declaration)
Public Property Session As SmtpSession
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim value As SmtpSession

instance.Session = value

value = instance.Session
C#
public SmtpSession Session {get; set;}
Managed Extensions for C++
public: __property SmtpSession* get_Session();
public: __property void set_Session(
   SmtpSession* value
);
C++/CLI
public:
property SmtpSession^ Session {
   SmtpSession^ get();
   void set (    SmtpSession^ value);
}

Property Value

SmtpSession

Remarks

This class is serializable, and can be used to persist a runtime session configuration.

Example

In this example, the Imap component gets messages from a specified mailbox and saves them to disk.
C# Copy Code
private void getMessages(object sender)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    //Specify folder to store messages
    string messageFolder = Application.StartupPath + "\\messages";

    //Download all messages in the account and save them to disk
    foreach (ImapMessage imapMessage in imap1.SelectedMailbox.ToArray())
    {
        imapMessage.Get();
        imapMessage.Message.Save(messageFolder + "\\" + imapMessage.Uid + ".eml");
    }

    //Gracefully logout of the session
    imap1.Close();
}

private void imap1_Progress(object sender, ImapProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub getMessages(ByVal sender As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Open the mailbox containing the messages to get
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    'Specify folder to store messages
    Dim messageFolder As String = Application.StartupPath & "\messages"

    'Download all messages in the account and save them to disk
    For Each imapMessage As ImapMessage In imap1.SelectedMailbox.ToArray()
        imapMessage.Get()
        imapMessage.Message.Save(messageFolder & "\" & imapMessage.Uid & ".eml")
    Next imapMessage

    'Gracefully logout of the session
    imap1.Close()
End Sub

Private Sub imap1_Progress(ByVal sender As Object, ByVal e As ImapProgressEventArgs) Handles imap1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Smtp Class
Smtp Members


Smtp Class Events

[image]
PowerTCP Mail for .NET
Smtp Class Events
See Also Send comments on this topic
Dart.Mail Namespace : Smtp Class

Glossary Item Box

For a list of all members of this type, see Smtp members.

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | Progress | Raised repeatedly while an email message is sent.
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

Smtp Class
Dart.Mail Namespace


Progress Event

[image]
PowerTCP Mail for .NET
Progress Event
See Also Example Send comments on this topic
Dart.Mail Namespace > Smtp Class : Progress Event

Glossary Item Box

Raised repeatedly while an email message is sent.

Syntax

Visual Basic (Declaration)
Public Event Progress As EventHandler(Of SmtpProgressEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As Smtp
Dim handler As EventHandler(Of SmtpProgressEventArgs)

AddHandler instance.Progress, handler
C#
public event EventHandler<SmtpProgressEventArgs> Progress
Managed Extensions for C++
public: __event EventHandler<SmtpProgressEventArgs*>* Progress
C++/CLI
public:
event EventHandler<SmtpProgressEventArgs^>^ Progress

Event Data

The event handler receives an argument of type SmtpProgressEventArgs containing data related to this event. The following SmtpProgressEventArgs properties provide information specific to this event.

Property | Description
Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Message | MailMessage being sent. Returns null if Send(Stream,String,String) was used.
Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)

Remarks

SmtpProgressEventArgs is provided, containing data about the progress (such as byte position, length, etc). To display progress using a ProgressBar, use 0 for System.Windows.Forms.ProgressBar.Minimum, Length for System.Windows.Forms.ProgressBar.Maximum, and Position for System.Windows.Forms.ProgressBar.Value. For more information on using events within the Visual Studio.NET environment, see "Using Events Within The Visual Studio.NET Environment".

MailSession.BlockSize controls the granularity.

If you are using the Smtp component as a reference, you must create a method and wire up the event yourself. See "Using Events When A Component Is Used As A Reference".

Set ComponentBase.SynchronizingObject to enable marshaling of this event to the UI thread.

Example

Uses the Smtp component to send a text message with an attachment.
C# Copy Code
private void sendMail(object sender)
{
    //Create message to send
    MailMessage message = new MailMessage();
    message.To = toAddress;
    message.From = fromAddress;
    message.Subject = "File Attached";
    message.Text = "Please see the attached file.";

    //Add the attachment
    message.Attachments.Add(new Attachment(Application.StartupPath + "\\myImage.jpg"));

    //Set session parameters
    smtp1.Session.RemoteEndPoint =
        new Dart.Mail.IPEndPoint(myMailServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;

    //Send message
    smtp1.Send(message);

    //Logout gracefully
    smtp1.Close();
}

private void smtp1_Progress(object sender, SmtpProgressEventArgs e)
{
    //Update progress bar as message is sent
    progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length);
}
Visual Basic Copy Code
Private Sub sendMail(ByVal sender As Object)
    'Create message to send
    Dim message As New MailMessage()
    message.To = toAddress
    message.From = fromAddress
    message.Subject = "File Attached"
    message.Text = "Please see the attached file."

    'Add the attachment
    message.Attachments.Add(New Attachment(Application.StartupPath & "\myImage.jpg"))

    'Set session parameters
    smtp1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myMailServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword

    'Send message
    smtp1.Send(message)

    'Logout gracefully
    smtp1.Close()
End Sub

Private Sub smtp1_Progress(ByVal sender As Object, ByVal e As SmtpProgressEventArgs) Handles smtp1.Progress
    'Update progress bar as message is sent
    progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length))
End Sub

See Also

Reference

Smtp Class
Smtp Members


SmtpProgressEventArgs Class

[image]
PowerTCP Mail for .NET
SmtpProgressEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : SmtpProgressEventArgs Class

Glossary Item Box

Provides data for Progress.

Object Model

SmtpProgressEventArgs ClassMailMessage Class

Syntax

Visual Basic (Declaration)
Public Class SmtpProgressEventArgs
   Inherits ProgressEventArgs
Visual Basic (Usage) Copy Code
Dim instance As SmtpProgressEventArgs
C#
public class SmtpProgressEventArgs : ProgressEventArgs
Managed Extensions for C++
public __gc class SmtpProgressEventArgs : public ProgressEventArgs
C++/CLI
public ref class SmtpProgressEventArgs : public ProgressEventArgs

Remarks

When a message is sent to the server, the Progress event is raised as each data buffer is processed. This event includes an SmtpProgressEventArgs instance with data useful for displaying progress to the user. For example, if you wish to display progress for the sending of a message, use 0 for System.Windows.Forms.ProgressBar.Minimum, ProgressEventArgs.Length for System.Windows.Forms.ProgressBar.Maximum, and ProgressEventArgs.Position for System.Windows.Forms.ProgressBar.Value.

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.ProgressEventArgs
Dart.Mail.SmtpProgressEventArgs

See Also

Reference

SmtpProgressEventArgs Members
Dart.Mail Namespace


SmtpProgressEventArgs Class Members

[image]
PowerTCP Mail for .NET
SmtpProgressEventArgs Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : SmtpProgressEventArgs Class

Glossary Item Box

The following tables list the members exposed by SmtpProgressEventArgs.

Public Properties

 | Name | Description
Public Property | Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Message | MailMessage being sent. Returns null if Send(Stream,String,String) was used.
Public Property | Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Top

See Also

Reference

SmtpProgressEventArgs Class
Dart.Mail Namespace


SmtpProgressEventArgs Class Properties

[image]
PowerTCP Mail for .NET
SmtpProgressEventArgs Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : SmtpProgressEventArgs Class

Glossary Item Box

For a list of all members of this type, see SmtpProgressEventArgs members.

Public Properties

 | Name | Description
Public Property | Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Public Property | Message | MailMessage being sent. Returns null if Send(Stream,String,String) was used.
Public Property | Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs)
Top

See Also

Reference

SmtpProgressEventArgs Class
Dart.Mail Namespace


Message Property

[image]
PowerTCP Mail for .NET
Message Property
See Also Send comments on this topic
Dart.Mail Namespace > SmtpProgressEventArgs Class : Message Property

Glossary Item Box

MailMessage being sent. Returns null if Send(Stream,String,String) was used.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Message As MailMessage
Visual Basic (Usage) Copy Code
Dim instance As SmtpProgressEventArgs
Dim value As MailMessage

value = instance.Message
C#
public MailMessage Message {get;}
Managed Extensions for C++
public: __property MailMessage* get_Message();
C++/CLI
public:
property MailMessage^ Message {
   MailMessage^ get();
}

See Also

Reference

SmtpProgressEventArgs Class
SmtpProgressEventArgs Members


SmtpResult Class

[image]
PowerTCP Mail for .NET
SmtpResult Class
Members See Also Send comments on this topic
Dart.Mail Namespace : SmtpResult Class

Glossary Item Box

Represents the results from an SMTP send operation.

Object Model

SmtpResult Class

Syntax

Visual Basic (Declaration)
Public Class SmtpResult
Visual Basic (Usage) Copy Code
Dim instance As SmtpResult
C#
public class SmtpResult
Managed Extensions for C++
public __gc class SmtpResult
C++/CLI
public ref class SmtpResult

Remarks

An SmtpResult is returned by each Send method, providing data about the sent message.

Inheritance Hierarchy

System.Object
Dart.Mail.SmtpResult

See Also

Reference

SmtpResult Members
Dart.Mail Namespace


SmtpResult Class Members

[image]
PowerTCP Mail for .NET
SmtpResult Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : SmtpResult Class

Glossary Item Box

The following tables list the members exposed by SmtpResult.

Public Properties

 | Name | Description
Public Property | Recipients | A collection of recipient addresses submitted to the server using the "RCPT TO" SMTP command, and the server's responses.
Public Property | SentLength | Gets the total length of all message data sent.
Top

See Also

Reference

SmtpResult Class
Dart.Mail Namespace


SmtpResult Class Properties

[image]
PowerTCP Mail for .NET
SmtpResult Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : SmtpResult Class

Glossary Item Box

For a list of all members of this type, see SmtpResult members.

Public Properties

 | Name | Description
Public Property | Recipients | A collection of recipient addresses submitted to the server using the "RCPT TO" SMTP command, and the server's responses.
Public Property | SentLength | Gets the total length of all message data sent.
Top

See Also

Reference

SmtpResult Class
Dart.Mail Namespace


Recipients Property

[image]
PowerTCP Mail for .NET
Recipients Property
See Also Send comments on this topic
Dart.Mail Namespace > SmtpResult Class : Recipients Property

Glossary Item Box

A collection of recipient addresses submitted to the server using the "RCPT TO" SMTP command, and the server's responses.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Recipients As List(Of Recipient)
Visual Basic (Usage) Copy Code
Dim instance As SmtpResult
Dim value As List(Of Recipient)

value = instance.Recipients
C#
public List<Recipient> Recipients {get;}
Managed Extensions for C++
public: __property List<Recipient*>* get_Recipients();
C++/CLI
public:
property List<Recipient^>^ Recipients {
   List<Recipient^>^ get();
}

Property Value

A generic List containing recipients and responses.

See Also

Reference

SmtpResult Class
SmtpResult Members


SentLength Property

[image]
PowerTCP Mail for .NET
SentLength Property
See Also Send comments on this topic
Dart.Mail Namespace > SmtpResult Class : SentLength Property

Glossary Item Box

Gets the total length of all message data sent.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property SentLength As Long
Visual Basic (Usage) Copy Code
Dim instance As SmtpResult
Dim value As Long

value = instance.SentLength
C#
public long SentLength {get;}
Managed Extensions for C++
public: __property long get_SentLength();
C++/CLI
public:
property int64 SentLength {
   int64 get();
}

Property Value

A long representing the length of all data sent.

Remarks

After the message is sent, check this property to see the number of bytes of data sent.

This data is also accessible via the Smtp.Progress event when the send is completed.

See Also

Reference

SmtpResult Class
SmtpResult Members


SmtpSession Class

[image]
PowerTCP Mail for .NET
SmtpSession Class
Members See Also Send comments on this topic
Dart.Mail Namespace : SmtpSession Class

Glossary Item Box

Holds configuration specialized for Imap.

Object Model

SmtpSession ClassIPEndPoint ClassProxy ClassIPEndPoint ClassMailSecurity Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class SmtpSession
   Inherits MailSession
Visual Basic (Usage) Copy Code
Dim instance As SmtpSession
C#
[Serializable()]
public class SmtpSession : MailSession
Managed Extensions for C++
[Serializable()]
public __gc class SmtpSession : public MailSession
C++/CLI
[Serializable()]
public ref class SmtpSession : public MailSession

Inheritance Hierarchy

System.Object
Dart.Mail.Session
Dart.Mail.TcpSession
Dart.Mail.AuthenticatedSession
Dart.Mail.MailSession
Dart.Mail.SmtpSession

See Also

Reference

SmtpSession Members
Dart.Mail Namespace


SmtpSession Class Members

[image]
PowerTCP Mail for .NET
SmtpSession Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : SmtpSession Class

Glossary Item Box

The following tables list the members exposed by SmtpSession.

Public Constructors

 | Name | Description
Public Constructor | SmtpSession Constructor | Default constructor.
Top

Public Properties

 | Name | Description
Public Property | Authentication | Authentication technique to use. Defaults to Authentication.Auto. (Inherited from Dart.Mail.MailSession)
Public Property | AutoPipeline | Gets or sets a value enabling command pipelining if the server supports it.
Public Property | AutoSize | Gets or sets a value indicating if the server will be asked if the message is too large before sending.
Public Property | BlockSize | Gets or sets the buffer size used during file and socket I/O. (Inherited from Dart.Mail.MailSession)
Public Property | ChunkSize | Gets or sets a value indicating the size of each chunk to be sent using the BDAT command.
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out. (Inherited from Dart.Mail.TcpSession)
Public Property | Domain | Gets or sets the domain (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Password | Gets or sets the password or OAuth access token used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Proxy | Defines the optional server proxy configuration. (Inherited from Dart.Mail.TcpSession)
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the privacy parameters to use with the mail server. See the MailSecurity class for more information. (Inherited from Dart.Mail.MailSession)
Public Property | ServicePrincipleName | Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Username | Gets or sets the username used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | UseSubmissionPort | Gets or sets a value to indicate whether the SMTP server uses the SMTP submission port (587) or traditional SMTP server port (25).
Top

Public Methods

 | Name | Description
Public Method | Clone | Creates a deep copy of the Session. (Inherited from Dart.Mail.MailSession)
Top

See Also

Reference

SmtpSession Class
Dart.Mail Namespace


SmtpSession Constructor

[image]
PowerTCP Mail for .NET
SmtpSession Constructor
See Also Send comments on this topic
Dart.Mail Namespace > SmtpSession Class : SmtpSession Constructor

Glossary Item Box

Default constructor.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New SmtpSession()
C#
public SmtpSession()
Managed Extensions for C++
public: SmtpSession();
C++/CLI
public:
SmtpSession();

See Also

Reference

SmtpSession Class
SmtpSession Members


SmtpSession Class Properties

[image]
PowerTCP Mail for .NET
SmtpSession Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : SmtpSession Class

Glossary Item Box

For a list of all members of this type, see SmtpSession members.

Public Properties

 | Name | Description
Public Property | Authentication | Authentication technique to use. Defaults to Authentication.Auto. (Inherited from Dart.Mail.MailSession)
Public Property | AutoPipeline | Gets or sets a value enabling command pipelining if the server supports it.
Public Property | AutoSize | Gets or sets a value indicating if the server will be asked if the message is too large before sending.
Public Property | BlockSize | Gets or sets the buffer size used during file and socket I/O. (Inherited from Dart.Mail.MailSession)
Public Property | ChunkSize | Gets or sets a value indicating the size of each chunk to be sent using the BDAT command.
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out. (Inherited from Dart.Mail.TcpSession)
Public Property | Domain | Gets or sets the domain (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Password | Gets or sets the password or OAuth access token used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Proxy | Defines the optional server proxy configuration. (Inherited from Dart.Mail.TcpSession)
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the privacy parameters to use with the mail server. See the MailSecurity class for more information. (Inherited from Dart.Mail.MailSession)
Public Property | ServicePrincipleName | Gets or sets the Service Principle Name (SPN) (used for GSSAPI and NTLM authentication only). (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | Username | Gets or sets the username used for login. (Inherited from Dart.Mail.AuthenticatedSession)
Public Property | UseSubmissionPort | Gets or sets a value to indicate whether the SMTP server uses the SMTP submission port (587) or traditional SMTP server port (25).
Top

See Also

Reference

SmtpSession Class
Dart.Mail Namespace


AutoPipeline Property

[image]
PowerTCP Mail for .NET
AutoPipeline Property
See Also Send comments on this topic
Dart.Mail Namespace > SmtpSession Class : AutoPipeline Property

Glossary Item Box

Gets or sets a value enabling command pipelining if the server supports it.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property AutoPipeline As Boolean
Visual Basic (Usage) Copy Code
Dim instance As SmtpSession
Dim value As Boolean

instance.AutoPipeline = value

value = instance.AutoPipeline
C#
[DefaultValue()]
public bool AutoPipeline {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_AutoPipeline();
public: __property void set_AutoPipeline(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool AutoPipeline {
   bool get();
   void set (    bool value);
}

Property Value

true if the component should send multiple commands without waiting for replies. Defaults to true.

Remarks

Some servers support PIPELINING, which can increase performance by sending multiple commands without waiting for responses. Set this property to false to prevent PIPELINING, which may be desirable under some conditions (for example, a firewall does not handle it correctly).

See Also

Reference

SmtpSession Class
SmtpSession Members


AutoSize Property

[image]
PowerTCP Mail for .NET
AutoSize Property
See Also Send comments on this topic
Dart.Mail Namespace > SmtpSession Class : AutoSize Property

Glossary Item Box

Gets or sets a value indicating if the server will be asked if the message is too large before sending.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property AutoSize As Boolean
Visual Basic (Usage) Copy Code
Dim instance As SmtpSession
Dim value As Boolean

instance.AutoSize = value

value = instance.AutoSize
C#
[DefaultValue()]
public bool AutoSize {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_AutoSize();
public: __property void set_AutoSize(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool AutoSize {
   bool get();
   void set (    bool value);
}

Property Value

true if the server should be asked if the message is too large before sending, otherwise false. Defaults to true.

Remarks

The advent of MIME, which introduced the transfer of greater amounts of non-ASCII files, resulted in much larger data load for SMTP servers. The SIZE command was introduced as a way for a server to announce the maximum file size it would accept and for a client to announce the size of data it is about to send. When a client announces the size of the data, the server then has an opportunity to accept or reject the data. If the SMTP server supports the SIZE command, Smtp.AutoSize controls whether or not this announcement is made.

If sending mail using a server that supports the SIZE command, set this value to false if you wish to keep the client from announcing the size of the data that will be sent.

See Also

Reference

SmtpSession Class
SmtpSession Members


ChunkSize Property

[image]
PowerTCP Mail for .NET
ChunkSize Property
See Also Send comments on this topic
Dart.Mail Namespace > SmtpSession Class : ChunkSize Property

Glossary Item Box

Gets or sets a value indicating the size of each chunk to be sent using the BDAT command.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property ChunkSize As Integer
Visual Basic (Usage) Copy Code
Dim instance As SmtpSession
Dim value As Integer

instance.ChunkSize = value

value = instance.ChunkSize
C#
[DefaultValue()]
public int ChunkSize {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_ChunkSize();
public: __property void set_ChunkSize(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int ChunkSize {
   int get();
   void set (    int value);
}

Property Value

If an ESMTP server supports chunking (MailBase.Capabilities contains "CHUNKING") the more efficient BDAT command is used instead of the legacy DATA command, and this value is used as the "chunk size". Set to 0 to disable the use of chunking.

See Also

Reference

SmtpSession Class
SmtpSession Members


UseSubmissionPort Property

[image]
PowerTCP Mail for .NET
UseSubmissionPort Property
See Also Send comments on this topic
Dart.Mail Namespace > SmtpSession Class : UseSubmissionPort Property

Glossary Item Box

Gets or sets a value to indicate whether the SMTP server uses the SMTP submission port (587) or traditional SMTP server port (25).

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property UseSubmissionPort As Boolean
Visual Basic (Usage) Copy Code
Dim instance As SmtpSession
Dim value As Boolean

instance.UseSubmissionPort = value

value = instance.UseSubmissionPort
C#
[DefaultValue()]
public bool UseSubmissionPort {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_UseSubmissionPort();
public: __property void set_UseSubmissionPort(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool UseSubmissionPort {
   bool get();
   void set (    bool value);
}

Remarks

Used by Smtp.GetDefaultPort to compute the port to use. Defaults to true.

See Also

Reference

SmtpSession Class
SmtpSession Members


SocketBase Class

[image]
PowerTCP Mail for .NET
SocketBase Class
Members See Also Send comments on this topic
Dart.Mail Namespace : SocketBase Class

Glossary Item Box

Base class for PowerTCP Components.

Object Model

SocketBase Class

Syntax

Visual Basic (Declaration)
Public Class SocketBase
   Inherits ComponentBase
Visual Basic (Usage) Copy Code
Dim instance As SocketBase
C#
public class SocketBase : ComponentBase
Managed Extensions for C++
public __gc class SocketBase : public ComponentBase
C++/CLI
public ref class SocketBase : public ComponentBase

Inheritance Hierarchy

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.Mail.ComponentBase
Dart.Mail.SocketBase
Dart.Mail.TcpBase

See Also

Reference

SocketBase Members
Dart.Mail Namespace


SocketBase Class Members

[image]
PowerTCP Mail for .NET
SocketBase Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : SocketBase Class

Glossary Item Box

The following tables list the members exposed by SocketBase.

Public Properties

 | Name | Description
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Character encoding used by the component. (Inherited from Dart.Mail.ComponentBase)
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | Socket | Gets the socket used by the component for communications.
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

Public Methods

 | Name | Description
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Disposes of SocketBase and its associated resources.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

SocketBase Class
Dart.Mail Namespace


SocketBase Class Methods

[image]
PowerTCP Mail for .NET
SocketBase Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : SocketBase Class

Glossary Item Box

For a list of all members of this type, see SocketBase members.

Public Methods

 | Name | Description
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Disposes of SocketBase and its associated resources.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

SocketBase Class
Dart.Mail Namespace


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > SocketBase Class : Dispose Method

Glossary Item Box

Disposes of SocketBase and its associated resources.

Overload List

Overload | Description
Dispose(Boolean) | Disposes of SocketBase and its associated resources.
Dispose() | (Inherited from System.ComponentModel.Component)

See Also

Reference

SocketBase Class
SocketBase Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > SocketBase Class > Dispose Method : Dispose(Boolean) Method

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Glossary Item Box

Disposes of SocketBase and its associated resources.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As SocketBase
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.

See Also

Reference

SocketBase Class
SocketBase Members
Overload List


SocketBase Class Properties

[image]
PowerTCP Mail for .NET
SocketBase Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : SocketBase Class

Glossary Item Box

For a list of all members of this type, see SocketBase members.

Public Properties

 | Name | Description
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Character encoding used by the component. (Inherited from Dart.Mail.ComponentBase)
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | Socket | Gets the socket used by the component for communications.
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

See Also

Reference

SocketBase Class
Dart.Mail Namespace


Socket Property

[image]
PowerTCP Mail for .NET
Socket Property
See Also Send comments on this topic
Dart.Mail Namespace > SocketBase Class : Socket Property

Glossary Item Box

Gets the socket used by the component for communications.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Socket As Socket
Visual Basic (Usage) Copy Code
Dim instance As SocketBase
Dim value As Socket

value = instance.Socket
C#
public Socket Socket {get;}
Managed Extensions for C++
public: __property Socket* get_Socket();
C++/CLI
public:
property Socket^ Socket {
   Socket^ get();
}

Property Value

The Socket used for UDP or TCP communications. Returns null when not in use.

See Also

Reference

SocketBase Class
SocketBase Members


SocketOption Class

[image]
PowerTCP Mail for .NET
SocketOption Class
Members See Also Send comments on this topic
Dart.Mail Namespace : SocketOption Class

Glossary Item Box

Contains socket options that may be set by TCP and UDP sockets. These options are automatically applied to the connection used.

Object Model

SocketOption Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class SocketOption
Visual Basic (Usage) Copy Code
Dim instance As SocketOption
C#
[Serializable()]
public class SocketOption
Managed Extensions for C++
[Serializable()]
public __gc class SocketOption
C++/CLI
[Serializable()]
public ref class SocketOption

Inheritance Hierarchy

System.Object
Dart.Mail.SocketOption
Dart.Mail.TcpSocketOption

See Also

Reference

SocketOption Members
Dart.Mail Namespace


SocketOption Class Members

[image]
PowerTCP Mail for .NET
SocketOption Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : SocketOption Class

Glossary Item Box

The following tables list the members exposed by SocketOption.

Public Properties

 | Name | Description
Public Property | ExclusiveAddressUse | When set to true, forbids multiple socket bindings to the same address. Set this value to true to ensure you have exclusive use of the local endpoint. Socket.ExclusiveAddressUse is set to this value before Socket.Bind is used.
Public Property | ReceiveBufferSize | Gets or sets a value that specifies the size of the system receive buffer.
Public Property | ReceiveTimeout | Gets or sets a value that specifies the amount of time after which the underlying Socket.Receive call will time out.
Public Property | ReuseAddress | When set to true, allows multiple socket bindings to the same address. Set this value to true to allow multiple sockets to bind to the same local address.
Public Property | SendBufferSize | Gets or sets a value that specifies the size of the system send buffer.
Public Property | SendTimeout | Gets or sets a value that specifies the amount of time after which the underlying Socket Send call will time out.
Top

See Also

Reference

SocketOption Class
Dart.Mail Namespace


SocketOption Class Properties

[image]
PowerTCP Mail for .NET
SocketOption Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : SocketOption Class

Glossary Item Box

For a list of all members of this type, see SocketOption members.

Public Properties

 | Name | Description
Public Property | ExclusiveAddressUse | When set to true, forbids multiple socket bindings to the same address. Set this value to true to ensure you have exclusive use of the local endpoint. Socket.ExclusiveAddressUse is set to this value before Socket.Bind is used.
Public Property | ReceiveBufferSize | Gets or sets a value that specifies the size of the system receive buffer.
Public Property | ReceiveTimeout | Gets or sets a value that specifies the amount of time after which the underlying Socket.Receive call will time out.
Public Property | ReuseAddress | When set to true, allows multiple socket bindings to the same address. Set this value to true to allow multiple sockets to bind to the same local address.
Public Property | SendBufferSize | Gets or sets a value that specifies the size of the system send buffer.
Public Property | SendTimeout | Gets or sets a value that specifies the amount of time after which the underlying Socket Send call will time out.
Top

See Also

Reference

SocketOption Class
Dart.Mail Namespace


ExclusiveAddressUse Property

[image]
PowerTCP Mail for .NET
ExclusiveAddressUse Property
See Also Send comments on this topic
Dart.Mail Namespace > SocketOption Class : ExclusiveAddressUse Property

Glossary Item Box

When set to true, forbids multiple socket bindings to the same address. Set this value to true to ensure you have exclusive use of the local endpoint. Socket.ExclusiveAddressUse is set to this value before Socket.Bind is used.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property ExclusiveAddressUse As Boolean
Visual Basic (Usage) Copy Code
Dim instance As SocketOption
Dim value As Boolean

instance.ExclusiveAddressUse = value

value = instance.ExclusiveAddressUse
C#
[DefaultValue()]
public bool ExclusiveAddressUse {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_ExclusiveAddressUse();
public: __property void set_ExclusiveAddressUse(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool ExclusiveAddressUse {
   bool get();
   void set (    bool value);
}

Remarks

Set this value to true to ensure you have exclusive use of the local endpoint. Socket.ExclusiveAddressUse is set to this value before Socket.Bind is used.

See Also

Reference

SocketOption Class
SocketOption Members


ReceiveBufferSize Property

[image]
PowerTCP Mail for .NET
ReceiveBufferSize Property
See Also Send comments on this topic
Dart.Mail Namespace > SocketOption Class : ReceiveBufferSize Property

Glossary Item Box

Gets or sets a value that specifies the size of the system receive buffer.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property ReceiveBufferSize As Integer
Visual Basic (Usage) Copy Code
Dim instance As SocketOption
Dim value As Integer

instance.ReceiveBufferSize = value

value = instance.ReceiveBufferSize
C#
[DefaultValue()]
public int ReceiveBufferSize {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_ReceiveBufferSize();
public: __property void set_ReceiveBufferSize(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int ReceiveBufferSize {
   int get();
   void set (    int value);
}

Property Value

An integer with a default value of 32786.

Remarks

Increasing the buffer size may help performance when transferring large amounts of data, or when high bandwidth, high latency connections (such as a satellite broadband provider) are used.

The value cannot be changed on CF devices.

See Also

Reference

SocketOption Class
SocketOption Members


ReceiveTimeout Property

[image]
PowerTCP Mail for .NET
ReceiveTimeout Property
See Also Send comments on this topic
Dart.Mail Namespace > SocketOption Class : ReceiveTimeout Property

Glossary Item Box

Gets or sets a value that specifies the amount of time after which the underlying Socket.Receive call will time out.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Overridable Property ReceiveTimeout As Integer
Visual Basic (Usage) Copy Code
Dim instance As SocketOption
Dim value As Integer

instance.ReceiveTimeout = value

value = instance.ReceiveTimeout
C#
[DefaultValue()]
public virtual int ReceiveTimeout {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property virtual int get_ReceiveTimeout();
public: __property virtual void set_ReceiveTimeout(
   int value
);
C++/CLI
[DefaultValue()]
public:
virtual property int ReceiveTimeout {
   int get();
   void set (    int value);
}

Property Value

The time-out value in milliseconds. The default value is 0, which indicates an infinite time-out period.

Remarks

A value of 0 or -1 indicates an infinite time-out period.

See Also

Reference

SocketOption Class
SocketOption Members


ReuseAddress Property

[image]
PowerTCP Mail for .NET
ReuseAddress Property
See Also Send comments on this topic
Dart.Mail Namespace > SocketOption Class : ReuseAddress Property

Glossary Item Box

When set to true, allows multiple socket bindings to the same address. Set this value to true to allow multiple sockets to bind to the same local address.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property ReuseAddress As Boolean
Visual Basic (Usage) Copy Code
Dim instance As SocketOption
Dim value As Boolean

instance.ReuseAddress = value

value = instance.ReuseAddress
C#
[DefaultValue()]
public bool ReuseAddress {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_ReuseAddress();
public: __property void set_ReuseAddress(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool ReuseAddress {
   bool get();
   void set (    bool value);
}

Remarks

Set this value to true to allow multiple sockets to bind to the same local address.

See Also

Reference

SocketOption Class
SocketOption Members


SendBufferSize Property

[image]
PowerTCP Mail for .NET
SendBufferSize Property
See Also Send comments on this topic
Dart.Mail Namespace > SocketOption Class : SendBufferSize Property

Glossary Item Box

Gets or sets a value that specifies the size of the system send buffer.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property SendBufferSize As Integer
Visual Basic (Usage) Copy Code
Dim instance As SocketOption
Dim value As Integer

instance.SendBufferSize = value

value = instance.SendBufferSize
C#
[DefaultValue()]
public int SendBufferSize {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_SendBufferSize();
public: __property void set_SendBufferSize(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int SendBufferSize {
   int get();
   void set (    int value);
}

Property Value

An integer with a default value of 8192.

Remarks

Increasing the buffer size may help performance when transferring large amounts of data, or when high bandwidth, high latency connections (such as a satellite broadband provider) are used.

See Also

Reference

SocketOption Class
SocketOption Members


SendTimeout Property

[image]
PowerTCP Mail for .NET
SendTimeout Property
See Also Send comments on this topic
Dart.Mail Namespace > SocketOption Class : SendTimeout Property

Glossary Item Box

Gets or sets a value that specifies the amount of time after which the underlying Socket Send call will time out.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property SendTimeout As Integer
Visual Basic (Usage) Copy Code
Dim instance As SocketOption
Dim value As Integer

instance.SendTimeout = value

value = instance.SendTimeout
C#
[DefaultValue()]
public int SendTimeout {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_SendTimeout();
public: __property void set_SendTimeout(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int SendTimeout {
   int get();
   void set (    int value);
}

Property Value

The time-out value in milliseconds. The default value is 0, which indicates an infinite time-out period.

Remarks

Values between 1 and 499 will be changed to 500, as 500 is the minimum positive value. Values of 0 and -1 indicate an infinite time-out period.

This option has no affect on CF devices (the Write method will not time out).

See Also

Reference

SocketOption Class
SocketOption Members


TcpBase Class

[image]
PowerTCP Mail for .NET
TcpBase Class
Members See Also Send comments on this topic
Dart.Mail Namespace : TcpBase Class

Glossary Item Box

Base class for components utilizing protocols built upon the TCP protocol.

Object Model

TcpBase ClassTcpSocketOption Class

Syntax

Visual Basic (Declaration)
Public Class TcpBase
   Inherits SocketBase
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
C#
public class TcpBase : SocketBase
Managed Extensions for C++
public __gc class TcpBase : public SocketBase
C++/CLI
public ref class TcpBase : public SocketBase

Inheritance Hierarchy

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.Mail.ComponentBase
Dart.Mail.SocketBase
Dart.Mail.TcpBase

See Also

Reference

TcpBase Members
Dart.Mail Namespace


TcpBase Class Members

[image]
PowerTCP Mail for .NET
TcpBase Class Members
See Also Properties Methods Events Send comments on this topic
Dart.Mail Namespace : TcpBase Class

Glossary Item Box

The following tables list the members exposed by TcpBase.

Public Properties

 | Name | Description
Public Property | CloseTime | Returns the DateTime the connection was closed.
Public Property | ConnectTime | Returns the DateTime the connection was established.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Character encoding used by the component. (Inherited from Dart.Mail.ComponentBase)
Public Property | NetworkStream | Returns the NetworkStream object created when Connect() is called.
Public Property | RemoteEndPoint | Gets the remote address and port of the connection.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | Socket | Gets the socket used by the component for communications. (Inherited from Dart.Mail.SocketBase)
Public Property | SocketOption | Gets and sets the socket options for classes derived from TcpBase.
Public Property | SslStream | Returns the SslStream object created when AuthenticateAsClient or AuthenticateAsServer are called.
Public Property | State | Gets the status of the connection as of the last socket operation.
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

Public Methods

 | Name | Description
Public Method | Abort | Performs a hard close of the connection.
Public Method | AuthenticateAsClient | Overloaded. Authenticates the server when establishing a secure connection.
Public Method | Close | Gracefully closes the connection.
Public Method | Connect | Connect to a server using the configuration specified by session.
Public Method | ConnectAsync | Connect to a server using the configuration specified by session.
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Disposes of TcpBase and its associated resources.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | GetStream | Provides access to the underlying Stream.
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals data to the UI thread.
Public Method | Read | Overloaded. Receives data from the remote host.
Public Method | ReadAsync | Start an asynchronous read on the socket.
Public Method | ReadToCount | Read until count bytes are read, an exception is thrown, or the connection is closed.
Public Method | ReadToDelimiter | Overloaded. Read until the delimiter is found, an exception is thrown, or the connection is closed.
Public Method | ReadToEnd | Read until the connection is closed or an exception is thrown.
Public Method | ShutdownSsl | Signals the remote host to shutdown the SSL connection.
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Public Method | Write | Overloaded. Sends data to the remote host.
Public Method | WriteAsync | Start an asynchronous write on the socket.
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnData | Raises the Data event.
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnLog | Raises the Log event.
Protected Method | OnStateChanged | Raises the StateChanged event.
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

Public Events

 | Name | Description
Public Event | Data | Raised when Marshal(Data,String,Object) is used.
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | Log | Raised when data is read or written.
Public Event | StateChanged | Raised when the value of the State property changes.
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

TcpBase Class
Dart.Mail Namespace


TcpBase Class Methods

[image]
PowerTCP Mail for .NET
TcpBase Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : TcpBase Class

Glossary Item Box

For a list of all members of this type, see TcpBase members.

Public Methods

 | Name | Description
Public Method | Abort | Performs a hard close of the connection.
Public Method | AuthenticateAsClient | Overloaded. Authenticates the server when establishing a secure connection.
Public Method | Close | Gracefully closes the connection.
Public Method | Connect | Connect to a server using the configuration specified by session.
Public Method | ConnectAsync | Connect to a server using the configuration specified by session.
Public Method | CreateObjRef | (Inherited from System.MarshalByRefObject)
Public Method | Dispose | Overloaded. Overridden. Disposes of TcpBase and its associated resources.
Public Method | GetLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | GetStream | Provides access to the underlying Stream.
Public Method | InitializeLifetimeService | (Inherited from System.MarshalByRefObject)
Public Method | Marshal | Overloaded. Marshals data to the UI thread.
Public Method | Read | Overloaded. Receives data from the remote host.
Public Method | ReadAsync | Start an asynchronous read on the socket.
Public Method | ReadToCount | Read until count bytes are read, an exception is thrown, or the connection is closed.
Public Method | ReadToDelimiter | Overloaded. Read until the delimiter is found, an exception is thrown, or the connection is closed.
Public Method | ReadToEnd | Read until the connection is closed or an exception is thrown.
Public Method | ShutdownSsl | Signals the remote host to shutdown the SSL connection.
Public Method | ToString | (Inherited from System.ComponentModel.Component)
Public Method | Write | Overloaded. Sends data to the remote host.
Public Method | WriteAsync | Start an asynchronous write on the socket.
Top

Protected Methods

 | Name | Description
Protected Method | Finalize | (Inherited from System.ComponentModel.Component)
Protected Method | GetService | (Inherited from System.ComponentModel.Component)
Protected Method | MemberwiseClone | Overloaded. (Inherited from System.MarshalByRefObject)
Protected Method | OnData | Raises the Data event.
Protected Method | OnError | Raises the Error event. (Inherited from Dart.Mail.ComponentBase)
Protected Method | OnLog | Raises the Log event.
Protected Method | OnStateChanged | Raises the StateChanged event.
Protected Method | OnUserState | Raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

TcpBase Class
Dart.Mail Namespace


Abort Method

[image]
PowerTCP Mail for .NET
Abort Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Abort Method

Glossary Item Box

Performs a hard close of the connection.

Syntax

Visual Basic (Declaration)
Public Sub Abort()
Visual Basic (Usage) Copy Code
Dim instance As TcpBase

instance.Abort()
C#
public void Abort()
Managed Extensions for C++
public: void Abort();
C++/CLI
public:
void Abort();

Remarks

This method resets the connection and immediately clears the socket state.

See Also

Reference

TcpBase Class
TcpBase Members


AuthenticateAsClient Method

[image]
PowerTCP Mail for .NET
AuthenticateAsClient Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : AuthenticateAsClient Method

Glossary Item Box

Authenticates the server when establishing a secure connection.

Overload List

Overload | Description
AuthenticateAsClient(ClientSecurity) | Authenticates the server when establishing a secure connection.
AuthenticateAsClient(TcpSession) | Authenticates the server when establishing a secure connection.

See Also

Reference

TcpBase Class
TcpBase Members


AuthenticateAsClient(ClientSecurity) Method

[image]
PowerTCP Mail for .NET
AuthenticateAsClient(ClientSecurity) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > TcpBase Class > AuthenticateAsClient Method : AuthenticateAsClient(ClientSecurity) Method

security
Security parameters used during authentication.

Glossary Item Box

Authenticates the server when establishing a secure connection.

Syntax

Visual Basic (Declaration)
<SecuritySafeCriticalAttribute()>
<ObsoleteAttribute("Use AuthenticeAsClient(Session) instead.")>
Public Overloads Sub AuthenticateAsClient( _
   ByVal security As ClientSecurity _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim security As ClientSecurity

instance.AuthenticateAsClient(security)
C#
[SecuritySafeCritical()]
[Obsolete("Use AuthenticeAsClient(Session) instead.")]
public void AuthenticateAsClient(
   ClientSecurity security
)
Managed Extensions for C++
[SecuritySafeCritical()]
[Obsolete("Use AuthenticeAsClient(Session) instead.")]
public: void AuthenticateAsClient(
   ClientSecurity* security
)
C++/CLI
[SecuritySafeCritical()]
[Obsolete("Use AuthenticeAsClient(Session) instead.")]
public:
void AuthenticateAsClient(
   ClientSecurity^ security
)

Parameters

security
Security parameters used during authentication.

Remarks

The security.TargetHost should match the server certificate name. If authentication fails, an AuthenticationException will occur.

To accept or reject a certificate "on-the-fly" implement a Security.ValidationCallback function.

To select a client certificate "on-the-fly" implement a ClientSecurity.SelectionCallback function.

Example

This example demonstrates the AuthenticateAsClient call, the callback that prompts for a local certificate, and the callback that executes when a certificate is received.
C# Copy Code
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;

/// <summary>
/// Establishes SSL with the provided Tcp object. Typically called immediately after connecting to the server (implicit)
/// or after a command such as STARTTLS is sent to the server (explicit).
/// </summary>
/// <param name="myComponent">Object to establish SSL with</param>
/// <param name="serverHostName">The name of the server</param>
/// <param name="protocols">Protocols the client will accept</param>
/// <param name="checkRevocation">Check certificate revocation list during authentication</param>
private void authenticateTcp(Tcp myComponent, string serverHostName, SslProtocols protocols, bool checkRevocation)
{
    //Specify configuration and certificate callback function, and authenticate server
    ClientSecurity security = new ClientSecurity();
    security.TargetHost = serverHostName;
    security.Protocols = protocols;
    security.CheckCertificateRevocation = checkRevocation;
    security.ValidationCallback = certificateReceived;
    security.SelectionCallback = selectLocalCertificate;
    myComponent.AuthenticateAsClient(security);
}

/// <summary>
/// Prompts the user to select a certificate for SSL authentication.
/// </summary>
/// <remarks>
/// This snippet assumes the presence of the Dart Test Certificate in the user's 'My' certificate store.
/// The Dart Test Certificate may be installed from the component's Start Menu program group.
/// For a UI-based certificate selection, please see the CertificateListForm included with our
/// WinForms samples.
/// </remarks>
/// <param name="targetHost">The host server specified by the client.</param>
/// <param name="localCertificates">A reference to ClientSecurity.Certificates</param>
/// <param name="remoteCertificate">The certificate used to authenticate the remote party.</param>
/// <param name="acceptableIssuers">A String array of certificate issuers acceptable to the remote party.</param>
/// <returns>An X509Certificate to use for establishing the SSL connection.</returns>
private X509Certificate selectLocalCertificate(Object sender, string targetHost,
    X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers)
{
    //Try to find the Dart Test Certificate
    X509Store certificateStore = new X509Store(StoreName.My);
    certificateStore.Open(OpenFlags.ReadOnly);
    foreach (X509Certificate2 cert in certificateStore.Certificates)
        if (cert.GetNameInfo(X509NameType.SimpleName, true) == "DartdomCA")
        {
            certificateStore.Close();
            return cert;
        }
    //Certificate not found, return null
    return null;
}

/// <summary>
/// Presents the server's certificate for validation.
/// </summary>
/// <param name="certificate">The certificate presented by the server</param>
/// <param name="chain">The chain of certificate authorities associated with the remote certificate</param>
/// <param name="sslPolicyErrors">One or more errors associated with the server's certificate</param>
/// <returns>A Boolean value that specifies whether the presented certificate is accepted for authentication</returns>
private bool certificateReceived(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //Accept certificate if it passed standard validation.
    if (sslPolicyErrors == SslPolicyErrors.None)
        return true;

    string msg = "The server could not be validated for the following reason(s):";

    if ((sslPolicyErrors & SslPolicyErrors.RemoteCertificateNotAvailable) == SslPolicyErrors.RemoteCertificateNotAvailable)
        msg += Environment.NewLine + "    -The server did not present a certificate.";
    else
    {
        if ((sslPolicyErrors & SslPolicyErrors.RemoteCertificateNameMismatch) == SslPolicyErrors.RemoteCertificateNameMismatch)
            msg += Environment.NewLine + "    -Certificate name mismatch.";
        if ((sslPolicyErrors & SslPolicyErrors.RemoteCertificateChainErrors) == SslPolicyErrors.RemoteCertificateChainErrors)
        {
            msg += Environment.NewLine + "    -Certificate chain errors:" + Environment.NewLine;

            foreach (X509ChainStatus item in chain.ChainStatus)
                msg += "    --" + item.StatusInformation;
        }
    }

    //Prompt to override security check
    msg += Environment.NewLine + "Override security check?";
    if (MessageBox.Show(msg, "Security Alert: Server could not be validated", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
        return true;
    else
        return false;
}
Visual Basic Copy Code
Imports System.Net.Security
Imports System.Security.Authentication
Imports System.Security.Cryptography.X509Certificates

''' <summary>
''' Establishes SSL with the provided Tcp object. Typically called immediately after connecting to the server (implicit)
''' or after a command such as STARTTLS is sent to the server (explicit).
''' </summary>
''' <param name="myComponent">Object to establish SSL with</param>
''' <param name="serverHostName">The name of the server</param>
''' <param name="protocols">Protocols the client will accept</param>
''' <param name="checkRevocation">Check certificate revocation list during authentication</param>
Private Sub authenticateTcp(ByVal myComponent As Tcp, ByVal serverHostName As String, ByVal protocols As SslProtocols, ByVal checkRevocation As Boolean)
    'Specify configuration and certificate callback function, and authenticate server
    Dim security As New ClientSecurity()
    security.TargetHost = serverHostName
    security.Protocols = protocols
    security.CheckCertificateRevocation = checkRevocation
    security.ValidationCallback = AddressOf certificateReceived
    security.SelectionCallback = AddressOf selectLocalCertificate
    myComponent.AuthenticateAsClient(security)
End Sub

''' <summary>
''' Prompts the user to select a certificate for SSL authentication.
''' </summary>
''' <remarks>
''' This snippet assumes the presence of the Dart Test Certificate in the user's 'My' certificate store.
''' The Dart Test Certificate may be installed from the component's Start Menu program group.
''' For a UI-based certificate selection, please see the CertificateListForm included with our
''' WinForms samples.
''' </remarks>
''' <param name="targetHost">The host server specified by the client.</param>
''' <param name="localCertificates">A reference to ClientSecurity.Certificates</param>
''' <param name="remoteCertificate">The certificate used to authenticate the remote party.</param>
''' <param name="acceptableIssuers">A String array of certificate issuers acceptable to the remote party.</param>
''' <returns>An X509Certificate to use for establishing the SSL connection.</returns>
Private Function selectLocalCertificate(ByVal sender As Object, ByVal targetHost As String, ByVal localCertificates As X509CertificateCollection, ByVal remoteCertificate As X509Certificate, ByVal acceptableIssuers() As String) As X509Certificate
    'Try to find the Dart Test Certificate
    Dim certificateStore As New X509Store(StoreName.My)
    certificateStore.Open(OpenFlags.ReadOnly)
    For Each cert As X509Certificate2 In certificateStore.Certificates
        If cert.GetNameInfo(X509NameType.SimpleName, True) = "DartdomCA" Then
            certificateStore.Close()
            Return cert
        End If
    Next cert
    'Certificate not found, return null
    Return Nothing
End Function

''' <summary>
''' Presents the server's certificate for validation.
''' </summary>
''' <param name="certificate">The certificate presented by the server</param>
''' <param name="chain">The chain of certificate authorities associated with the remote certificate</param>
''' <param name="sslPolicyErrors">One or more errors associated with the server's certificate</param>
''' <returns>A Boolean value that specifies whether the presented certificate is accepted for authentication</returns>
Private Function certificateReceived(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'Accept certificate if it passed standard validation.
    If sslPolicyErrors = System.Net.Security.SslPolicyErrors.None Then
        Return True
    End If

    Dim msg As String = "The server could not be validated for the following reason(s):"

    If (sslPolicyErrors And System.Net.Security.SslPolicyErrors.RemoteCertificateNotAvailable) = System.Net.Security.SslPolicyErrors.RemoteCertificateNotAvailable Then
        msg &= Environment.NewLine & "    -The server did not present a certificate."
    Else
        If (sslPolicyErrors And System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch) = System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch Then
            msg &= Environment.NewLine & "    -Certificate name mismatch."
        End If
        If (sslPolicyErrors And System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors) = System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors Then
            msg &= Environment.NewLine & "    -Certificate chain errors:" & Environment.NewLine

            For Each item As X509ChainStatus In chain.ChainStatus
                msg &= "    --" & item.StatusInformation
            Next item
        End If
    End If

    'Prompt to override security check
    msg &= Environment.NewLine & "Override security check?"
    If MessageBox.Show(msg, "Security Alert: Server could not be validated", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = System.Windows.Forms.DialogResult.Yes Then
        Return True
    Else
        Return False
    End If
End Function

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


AuthenticateAsClient(TcpSession) Method

[image]
PowerTCP Mail for .NET
AuthenticateAsClient(TcpSession) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > TcpBase Class > AuthenticateAsClient Method : AuthenticateAsClient(TcpSession) Method

session
Session parameters used during authentication.

Glossary Item Box

Authenticates the server when establishing a secure connection.

Syntax

Visual Basic (Declaration)
<SecuritySafeCriticalAttribute()>
Public Overloads Sub AuthenticateAsClient( _
   ByVal session As TcpSession _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim session As TcpSession

instance.AuthenticateAsClient(session)
C#
[SecuritySafeCritical()]
public void AuthenticateAsClient(
   TcpSession session
)
Managed Extensions for C++
[SecuritySafeCritical()]
public: void AuthenticateAsClient(
   TcpSession* session
)
C++/CLI
[SecuritySafeCritical()]
public:
void AuthenticateAsClient(
   TcpSession^ session
)

Parameters

session
Session parameters used during authentication.

Remarks

Uses Session.RemoteEndPoint, TcpSession.Proxy and TcpSession.Security to specify Security.ValidationCallback, SelectionCallback, ClientSecurity.TargetHost, Certificates, Security.Protocols, and Security.CheckCertificateRevocation.

If session.Security.TargetHost is not specifed, then session.RemoteEndPoint.HostNameOrAddress will be used instead. session.Security.TargetHost should match the server certificate name. If authentication fails, an AuthenticationException will occur.

To accept or reject a certificate "on-the-fly" implement a Security.ValidationCallback function.

To select a client certificate "on-the-fly" implement a ClientSecurity.SelectionCallback function.

Example

This example demonstrates the AuthenticateAsClient call, the callback that prompts for a local certificate, and the callback that executes when a certificate is received.
C# Copy Code
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;

/// <summary>
/// Establishes SSL with the provided Tcp object. Typically called immediately after connecting to the server (implicit)
/// or after a command such as STARTTLS is sent to the server (explicit).
/// </summary>
/// <param name="myComponent">Object to establish SSL with</param>
/// <param name="serverHostName">The name of the server</param>
/// <param name="protocols">Protocols the client will accept</param>
/// <param name="checkRevocation">Check certificate revocation list during authentication</param>
private void authenticateTcp(Tcp myComponent, string serverHostName, SslProtocols protocols, bool checkRevocation)
{
    //Specify configuration and certificate callback function, and authenticate server
    ClientSecurity security = new ClientSecurity();
    security.TargetHost = serverHostName;
    security.Protocols = protocols;
    security.CheckCertificateRevocation = checkRevocation;
    security.ValidationCallback = certificateReceived;
    security.SelectionCallback = selectLocalCertificate;
    myComponent.AuthenticateAsClient(security);
}

/// <summary>
/// Prompts the user to select a certificate for SSL authentication.
/// </summary>
/// <remarks>
/// This snippet assumes the presence of the Dart Test Certificate in the user's 'My' certificate store.
/// The Dart Test Certificate may be installed from the component's Start Menu program group.
/// For a UI-based certificate selection, please see the CertificateListForm included with our
/// WinForms samples.
/// </remarks>
/// <param name="targetHost">The host server specified by the client.</param>
/// <param name="localCertificates">A reference to ClientSecurity.Certificates</param>
/// <param name="remoteCertificate">The certificate used to authenticate the remote party.</param>
/// <param name="acceptableIssuers">A String array of certificate issuers acceptable to the remote party.</param>
/// <returns>An X509Certificate to use for establishing the SSL connection.</returns>
private X509Certificate selectLocalCertificate(Object sender, string targetHost,
    X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers)
{
    //Try to find the Dart Test Certificate
    X509Store certificateStore = new X509Store(StoreName.My);
    certificateStore.Open(OpenFlags.ReadOnly);
    foreach (X509Certificate2 cert in certificateStore.Certificates)
        if (cert.GetNameInfo(X509NameType.SimpleName, true) == "DartdomCA")
        {
            certificateStore.Close();
            return cert;
        }
    //Certificate not found, return null
    return null;
}

/// <summary>
/// Presents the server's certificate for validation.
/// </summary>
/// <param name="certificate">The certificate presented by the server</param>
/// <param name="chain">The chain of certificate authorities associated with the remote certificate</param>
/// <param name="sslPolicyErrors">One or more errors associated with the server's certificate</param>
/// <returns>A Boolean value that specifies whether the presented certificate is accepted for authentication</returns>
private bool certificateReceived(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    //Accept certificate if it passed standard validation.
    if (sslPolicyErrors == SslPolicyErrors.None)
        return true;

    string msg = "The server could not be validated for the following reason(s):";

    if ((sslPolicyErrors & SslPolicyErrors.RemoteCertificateNotAvailable) == SslPolicyErrors.RemoteCertificateNotAvailable)
        msg += Environment.NewLine + "    -The server did not present a certificate.";
    else
    {
        if ((sslPolicyErrors & SslPolicyErrors.RemoteCertificateNameMismatch) == SslPolicyErrors.RemoteCertificateNameMismatch)
            msg += Environment.NewLine + "    -Certificate name mismatch.";
        if ((sslPolicyErrors & SslPolicyErrors.RemoteCertificateChainErrors) == SslPolicyErrors.RemoteCertificateChainErrors)
        {
            msg += Environment.NewLine + "    -Certificate chain errors:" + Environment.NewLine;

            foreach (X509ChainStatus item in chain.ChainStatus)
                msg += "    --" + item.StatusInformation;
        }
    }

    //Prompt to override security check
    msg += Environment.NewLine + "Override security check?";
    if (MessageBox.Show(msg, "Security Alert: Server could not be validated", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
        return true;
    else
        return false;
}
Visual Basic Copy Code
Imports System.Net.Security
Imports System.Security.Authentication
Imports System.Security.Cryptography.X509Certificates

''' <summary>
''' Establishes SSL with the provided Tcp object. Typically called immediately after connecting to the server (implicit)
''' or after a command such as STARTTLS is sent to the server (explicit).
''' </summary>
''' <param name="myComponent">Object to establish SSL with</param>
''' <param name="serverHostName">The name of the server</param>
''' <param name="protocols">Protocols the client will accept</param>
''' <param name="checkRevocation">Check certificate revocation list during authentication</param>
Private Sub authenticateTcp(ByVal myComponent As Tcp, ByVal serverHostName As String, ByVal protocols As SslProtocols, ByVal checkRevocation As Boolean)
    'Specify configuration and certificate callback function, and authenticate server
    Dim security As New ClientSecurity()
    security.TargetHost = serverHostName
    security.Protocols = protocols
    security.CheckCertificateRevocation = checkRevocation
    security.ValidationCallback = AddressOf certificateReceived
    security.SelectionCallback = AddressOf selectLocalCertificate
    myComponent.AuthenticateAsClient(security)
End Sub

''' <summary>
''' Prompts the user to select a certificate for SSL authentication.
''' </summary>
''' <remarks>
''' This snippet assumes the presence of the Dart Test Certificate in the user's 'My' certificate store.
''' The Dart Test Certificate may be installed from the component's Start Menu program group.
''' For a UI-based certificate selection, please see the CertificateListForm included with our
''' WinForms samples.
''' </remarks>
''' <param name="targetHost">The host server specified by the client.</param>
''' <param name="localCertificates">A reference to ClientSecurity.Certificates</param>
''' <param name="remoteCertificate">The certificate used to authenticate the remote party.</param>
''' <param name="acceptableIssuers">A String array of certificate issuers acceptable to the remote party.</param>
''' <returns>An X509Certificate to use for establishing the SSL connection.</returns>
Private Function selectLocalCertificate(ByVal sender As Object, ByVal targetHost As String, ByVal localCertificates As X509CertificateCollection, ByVal remoteCertificate As X509Certificate, ByVal acceptableIssuers() As String) As X509Certificate
    'Try to find the Dart Test Certificate
    Dim certificateStore As New X509Store(StoreName.My)
    certificateStore.Open(OpenFlags.ReadOnly)
    For Each cert As X509Certificate2 In certificateStore.Certificates
        If cert.GetNameInfo(X509NameType.SimpleName, True) = "DartdomCA" Then
            certificateStore.Close()
            Return cert
        End If
    Next cert
    'Certificate not found, return null
    Return Nothing
End Function

''' <summary>
''' Presents the server's certificate for validation.
''' </summary>
''' <param name="certificate">The certificate presented by the server</param>
''' <param name="chain">The chain of certificate authorities associated with the remote certificate</param>
''' <param name="sslPolicyErrors">One or more errors associated with the server's certificate</param>
''' <returns>A Boolean value that specifies whether the presented certificate is accepted for authentication</returns>
Private Function certificateReceived(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
    'Accept certificate if it passed standard validation.
    If sslPolicyErrors = System.Net.Security.SslPolicyErrors.None Then
        Return True
    End If

    Dim msg As String = "The server could not be validated for the following reason(s):"

    If (sslPolicyErrors And System.Net.Security.SslPolicyErrors.RemoteCertificateNotAvailable) = System.Net.Security.SslPolicyErrors.RemoteCertificateNotAvailable Then
        msg &= Environment.NewLine & "    -The server did not present a certificate."
    Else
        If (sslPolicyErrors And System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch) = System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch Then
            msg &= Environment.NewLine & "    -Certificate name mismatch."
        End If
        If (sslPolicyErrors And System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors) = System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors Then
            msg &= Environment.NewLine & "    -Certificate chain errors:" & Environment.NewLine

            For Each item As X509ChainStatus In chain.ChainStatus
                msg &= "    --" & item.StatusInformation
            Next item
        End If
    End If

    'Prompt to override security check
    msg &= Environment.NewLine & "Override security check?"
    If MessageBox.Show(msg, "Security Alert: Server could not be validated", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = System.Windows.Forms.DialogResult.Yes Then
        Return True
    Else
        Return False
    End If
End Function

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


Close() Method

[image]
PowerTCP Mail for .NET
Close() Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Close() Method

Glossary Item Box

Gracefully closes the connection.

Syntax

Visual Basic (Declaration)
Public Overridable Sub Close()
Visual Basic (Usage) Copy Code
Dim instance As TcpBase

instance.Close()
C#
public virtual void Close()
Managed Extensions for C++
public: virtual void Close();
C++/CLI
public:
virtual void Close();

Remarks

This method enters a normal TIME_WAIT state after the connection is closed.

See Also

Reference

TcpBase Class
TcpBase Members


Connect Method

[image]
PowerTCP Mail for .NET
Connect Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Connect Method

session
Used to specify the local and remote endpoints, and proxy configuration.

Glossary Item Box

Connect to a server using the configuration specified by session.

Syntax

Visual Basic (Declaration)
Public Sub Connect( _
   ByVal session As TcpSession _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim session As TcpSession

instance.Connect(session)
C#
public void Connect(
   TcpSession session
)
Managed Extensions for C++
public: void Connect(
   TcpSession* session
)
C++/CLI
public:
void Connect(
   TcpSession^ session
)

Parameters

session
Used to specify the local and remote endpoints, and proxy configuration.

See Also

Reference

TcpBase Class
TcpBase Members


ConnectAsync Method

[image]
PowerTCP Mail for .NET
ConnectAsync Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : ConnectAsync Method

session
Used to specify the local and remote endpoints, and proxy configuration.
callback
A TcpAsyncCallback delegate referencing the method to invoke on an IO completion thread when the operation completes.
state
Object to pass into the callback method when the operation completes; can be null.

Glossary Item Box

Connect to a server using the configuration specified by session.

Syntax

Visual Basic (Declaration)
Public Sub ConnectAsync( _
   ByVal session As TcpSession, _
   ByVal callback As TcpAsyncCallback, _
   ByVal state As Object _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim session As TcpSession
Dim callback As TcpAsyncCallback
Dim state As Object

instance.ConnectAsync(session, callback, state)
C#
public void ConnectAsync(
   TcpSession session,
   TcpAsyncCallback callback,
   object state
)
Managed Extensions for C++
public: void ConnectAsync(
   TcpSession* session,
   TcpAsyncCallback* callback,
   Object* state
)
C++/CLI
public:
void ConnectAsync(
   TcpSession^ session,
   TcpAsyncCallback^ callback,
   Object^ state
)

Parameters

session
Used to specify the local and remote endpoints, and proxy configuration.
callback
A TcpAsyncCallback delegate referencing the method to invoke on an IO completion thread when the operation completes.
state
Object to pass into the callback method when the operation completes; can be null.

See Also

Reference

TcpBase Class
TcpBase Members


Dispose Method

[image]
PowerTCP Mail for .NET
Dispose Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Dispose Method

Glossary Item Box

Disposes of TcpBase and its associated resources.

Overload List

Overload | Description
Dispose(Boolean) | Disposes of TcpBase and its associated resources.
Dispose() | (Inherited from System.ComponentModel.Component)

See Also

Reference

TcpBase Class
TcpBase Members


Dispose(Boolean) Method

[image]
PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > Dispose Method : Dispose(Boolean) Method

disposing

Glossary Item Box

Disposes of TcpBase and its associated resources.

Syntax

Visual Basic (Declaration)
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim disposing As Boolean

instance.Dispose(disposing)
C#
protected override void Dispose(
   bool disposing
)
Managed Extensions for C++
protected: void Dispose(
   bool disposing
) override
C++/CLI
protected:
void Dispose(
   bool disposing
) override

Parameters

disposing

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


GetStream Method

[image]
PowerTCP Mail for .NET
GetStream Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : GetStream Method

Glossary Item Box

Provides access to the underlying Stream.

Syntax

Visual Basic (Declaration)
Public Overridable Function GetStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As Stream

value = instance.GetStream()
C#
public virtual Stream GetStream()
Managed Extensions for C++
public: virtual Stream* GetStream();
C++/CLI
public:
virtual Stream^ GetStream();

Return Value

The underlying Stream object used by the component.

Remarks

Derived classes can override this method to provide a stream that implements an upper-layer protocol.

See Also

Reference

TcpBase Class
TcpBase Members


Marshal Method

[image]
PowerTCP Mail for .NET
Marshal Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Marshal Method

Glossary Item Box

Marshals data to the UI thread.

Overload List

Overload | Description
Marshal(Data,String,Object) | Marshals data to the UI thread.
Marshal(String,Object) | Marshals a string and/or object to the UI thread and raises the UserState event. (Inherited from Dart.Mail.ComponentBase)
Marshal(Exception) | Marshals an exception to the UI thread and raises the Error event. (Inherited from Dart.Mail.ComponentBase)

See Also

Reference

TcpBase Class
TcpBase Members


Marshal(Data,String,Object) Method

[image]
PowerTCP Mail for .NET
Marshal(Data,String,Object) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > TcpBase Class > Marshal Method : Marshal(Data,String,Object) Method

data
Data to be marshaled.
message
Text message to be marshaled.
state
State information to be marshaled.

Glossary Item Box

Marshals data to the UI thread.

Syntax

Visual Basic (Declaration)
Public Overloads Sub Marshal( _
   ByVal data As Data, _
   ByVal message As String, _
   ByVal state As Object _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim data As Data
Dim message As String
Dim state As Object

instance.Marshal(data, message, state)
C#
public void Marshal(
   Data data,
   string message,
   object state
)
Managed Extensions for C++
public: void Marshal(
   Data* data,
   string* message,
   Object* state
)
C++/CLI
public:
void Marshal(
   Data^ data,
   String^ message,
   Object^ state
)

Parameters

data
Data to be marshaled.
message
Text message to be marshaled.
state
State information to be marshaled.

Remarks

This method is used to marshal data from a worker thread to the UI thread for typical display purposes. It calls the OnData method, which raises the Data event.

See the SynchronizingObject property for information on updating UI controls in your event handler.

Example

This example demonstrates execution of a looping Read on a worker thread, and marshaling the data to the UI.
C# Copy Code
private void button1_Click(object sender, EventArgs e)
{
    myComponent.Start(readLoopWorker, null);
}

private void readLoopWorker(object state)
{
    byte[] buffer = new byte[1024];
    Data data = myComponent.Read(buffer);
    while (data != null)
    {
        myComponent.Marshal(data, "", null);
        data = myComponent.Read(buffer);
    }
    myComponent.Close();
}

void myComponent_Data(object sender, Dart.Sockets.DataEventArgs e)
{
    textBox1.AppendText(e.Data.ToString());
}
Visual Basic Copy Code
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
    myComponent.Start(AddressOf readLoopWorker, Nothing)
End Sub

Private Sub readLoopWorker(ByVal state As Object)
    Dim buffer(1023) As Byte
    Dim data As Data = myComponent.Read(buffer)
    Do While data IsNot Nothing
        myComponent.Marshal(data, "", Nothing)
        data = myComponent.Read(buffer)
    Loop
    myComponent.Close()
End Sub

Private Sub myComponent_Data(ByVal sender As Object, ByVal e As Dart.Sockets.DataEventArgs)
    textBox1.AppendText(e.Data.ToString())
End Sub

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


OnData Method

[image]
PowerTCP Mail for .NET
OnData Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : OnData Method

e
A DataEventArgs object that contains the event data.

Glossary Item Box

Raises the Data event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnData( _
   ByVal e As DataEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim e As DataEventArgs

instance.OnData(e)
C#
protected virtual void OnData(
   DataEventArgs e
)
Managed Extensions for C++
protected: virtual void OnData(
   DataEventArgs* e
)
C++/CLI
protected:
virtual void OnData(
   DataEventArgs^ e
)

Parameters

e
A DataEventArgs object that contains the event data.

Remarks

If the Synchronizing property is set, this method synchronously invokes the Data event on the UI thread. If the Synchronizing property is null, this method invokes the event on the executing thread.

The OnData method allows derived classes to handle the event without attaching a delegate, but marshaling is not provided. This is the preferred technique for handling the event in a derived class.

Note to Inheritors: When overriding OnData in a derived class, be sure to call the base class OnData method, so that registered delegates receive the event.

See the SynchronizingObject property for information on updating UI controls in your event handler.

See Also

Reference

TcpBase Class
TcpBase Members


OnLog Method

[image]
PowerTCP Mail for .NET
OnLog Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : OnLog Method

e
A DataEventArgs object containing data to log.

Glossary Item Box

Raises the Log event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnLog( _
   ByVal e As DataEventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim e As DataEventArgs

instance.OnLog(e)
C#
protected virtual void OnLog(
   DataEventArgs e
)
Managed Extensions for C++
protected: virtual void OnLog(
   DataEventArgs* e
)
C++/CLI
protected:
virtual void OnLog(
   DataEventArgs^ e
)

Parameters

e
A DataEventArgs object containing data to log.

Remarks

If the Synchronizing property is set, this method asynchronously invokes the event on the UI thread. If the Synchronizing property is null, this method invokes the event on the executing thread.

The OnLog method allows derived classes to handle the event without attaching a delegate, but marshaling is not provided. This is the preferred technique for handling the event in a derived class.

Note to Inheritors: When overriding OnLog in a derived class, be sure to call the base class OnLog method, so that registered delegates receive the event.

See the SynchronizingObject property for information on updating UI controls in your event handler.

See Also

Reference

TcpBase Class
TcpBase Members


OnStateChanged Method

[image]
PowerTCP Mail for .NET
OnStateChanged Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : OnStateChanged Method

e
An EventArgs.

Glossary Item Box

Raises the StateChanged event.

Syntax

Visual Basic (Declaration)
Protected Overridable Sub OnStateChanged( _
   ByVal e As EventArgs _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim e As EventArgs

instance.OnStateChanged(e)
C#
protected virtual void OnStateChanged(
   EventArgs e
)
Managed Extensions for C++
protected: virtual void OnStateChanged(
   EventArgs* e
)
C++/CLI
protected:
virtual void OnStateChanged(
   EventArgs^ e
)

Parameters

e
An EventArgs.

Remarks

If the Synchronizing property is set, this method synchronously invokes the event on the UI thread. If the Synchronizing property is null, this method invokes the event on the executing thread.

The OnStateChanged method allows derived classes to handle the event without attaching a delegate, but marshaling is not provided. This is the preferred technique for handling the event in a derived class.

Note to Inheritors: When overriding OnStateChanged in a derived class, be sure to call the base class OnStateChanged method, so that registered delegates receive the event.

See the SynchronizingObject property for information on updating UI controls in your event handler.

See Also

Reference

TcpBase Class
TcpBase Members


Read Method

[image]
PowerTCP Mail for .NET
Read Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Read Method

Glossary Item Box

Receives data from the remote host.

Overload List

Overload | Description
Read(Byte[],Int32,Int32) | Receives data from the remote host.
Read(Byte[]) | Receives data from the remote host.

See Also

Reference

TcpBase Class
TcpBase Members


Read(Byte[],Int32,Int32) Method

[image]
PowerTCP Mail for .NET
Read(Byte[],Int32,Int32) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > Read Method : Read(Byte[],Int32,Int32) Method

buffer
The byte array used to store the received data.
offset
The position in the buffer to store the data.
count
The maximum number of bytes to receive.

Glossary Item Box

Receives data from the remote host.

Syntax

Visual Basic (Declaration)
Public Overloads Function Read( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim buffer() As Byte
Dim offset As Integer
Dim count As Integer
Dim value As Data

value = instance.Read(buffer, offset, count)
C#
public Data Read(
   byte[] buffer,
   int offset,
   int count
)
Managed Extensions for C++
public: Data* Read(
   byte[]* buffer,
   int offset,
   int count
)
C++/CLI
public:
Data^ Read(
   array<byte>^ buffer,
   int offset,
   int count
)

Parameters

buffer
The byte array used to store the received data.
offset
The position in the buffer to store the data.
count
The maximum number of bytes to receive.

Return Value

A Data object encapsulating the received data. Returns null if the socket is closed.

Remarks

This method performs a single socket read, blocking until at least one byte is read, up to as much data as is available on the socket, count bytes, or buffer.Length, whichever is lowest. A SocketException indicating SocketError.Timeout will not result in the socket being closed; other SocketExceptions are fatal and the socket is automatically closed by the class.

The ReceiveTimeout property controls how long this method will block before throwing a Timeout exception.

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


Read(Byte[]) Method

[image]
PowerTCP Mail for .NET
Read(Byte[]) Method
See Also Example Send comments on this topic
Dart.Mail Namespace > TcpBase Class > Read Method : Read(Byte[]) Method

buffer
The byte array used to store the received data.

Glossary Item Box

Receives data from the remote host.

Syntax

Visual Basic (Declaration)
Public Overloads Function Read( _
   ByVal buffer() As Byte _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim buffer() As Byte
Dim value As Data

value = instance.Read(buffer)
C#
public Data Read(
   byte[] buffer
)
Managed Extensions for C++
public: Data* Read(
   byte[]* buffer
)
C++/CLI
public:
Data^ Read(
   array<byte>^ buffer
)

Parameters

buffer
The byte array used to store the received data.

Return Value

A Data object encapsulating the received data. Returns null if the socket is closed.

Remarks

This method performs a single socket read, blocking until at least one byte is read, up to as much data as is available on the socket or buffer.Length, whichever is lowest.

This method will block until data is available or the ReceiveTimeout has expired.

Example

This example demonstrates execution of a looping Read on a worker thread, and marshaling the data to the UI.
C# Copy Code
private void button1_Click(object sender, EventArgs e)
{
    myComponent.Start(readLoopWorker, null);
}

private void readLoopWorker(object state)
{
    byte[] buffer = new byte[1024];
    Data data = myComponent.Read(buffer);
    while (data != null)
    {
        myComponent.Marshal(data, "", null);
        data = myComponent.Read(buffer);
    }
    myComponent.Close();
}

void myComponent_Data(object sender, Dart.Sockets.DataEventArgs e)
{
    textBox1.AppendText(e.Data.ToString());
}
Visual Basic Copy Code
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
    myComponent.Start(AddressOf readLoopWorker, Nothing)
End Sub

Private Sub readLoopWorker(ByVal state As Object)
    Dim buffer(1023) As Byte
    Dim data As Data = myComponent.Read(buffer)
    Do While data IsNot Nothing
        myComponent.Marshal(data, "", Nothing)
        data = myComponent.Read(buffer)
    Loop
    myComponent.Close()
End Sub

Private Sub myComponent_Data(ByVal sender As Object, ByVal e As Dart.Sockets.DataEventArgs)
    textBox1.AppendText(e.Data.ToString())
End Sub

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


ReadAsync Method

[image]
PowerTCP Mail for .NET
ReadAsync Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : ReadAsync Method

buffer
The byte array used to store the received data.
offset
The position in the buffer to store the data.
count
The maximum number of bytes to receive.
callback
A TcpAsyncCallback delegate referencing the method to invoke on an IO completion thread when the operation completes.
state
Object to pass into the callback method when the operation completes; can be null.

Glossary Item Box

Start an asynchronous read on the socket.

Syntax

Visual Basic (Declaration)
Public Sub ReadAsync( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer, _
   ByVal callback As TcpAsyncCallback, _
   ByVal state As Object _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim buffer() As Byte
Dim offset As Integer
Dim count As Integer
Dim callback As TcpAsyncCallback
Dim state As Object

instance.ReadAsync(buffer, offset, count, callback, state)
C#
public void ReadAsync(
   byte[] buffer,
   int offset,
   int count,
   TcpAsyncCallback callback,
   object state
)
Managed Extensions for C++
public: void ReadAsync(
   byte[]* buffer,
   int offset,
   int count,
   TcpAsyncCallback* callback,
   Object* state
)
C++/CLI
public:
void ReadAsync(
   array<byte>^ buffer,
   int offset,
   int count,
   TcpAsyncCallback^ callback,
   Object^ state
)

Parameters

buffer
The byte array used to store the received data.
offset
The position in the buffer to store the data.
count
The maximum number of bytes to receive.
callback
A TcpAsyncCallback delegate referencing the method to invoke on an IO completion thread when the operation completes.
state
Object to pass into the callback method when the operation completes; can be null.

Remarks

The TCP component is typically used by making blocking calls on a worker (non-UI) thread. This technique keeps development simple as there is no need for saving state information, but does require a dedicated thread for each connection. If a dedicated worker thread for each socket is not scalable enough, such as in server applications, developers can instead use the Async methods which utilize IO completion ports. The Async methods do not require a dedicated worker thread for each connection, and the specified callback is invoked on an IO completion thread when the operation completes. This is the best way to create a high-performance server without using dedicated worker threads.

See Also

Reference

TcpBase Class
TcpBase Members


ReadToCount Method

[image]
PowerTCP Mail for .NET
ReadToCount Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : ReadToCount Method

buffer
The byte array used to store the received data.
offset
The position in the buffer to store the data.
count
The number of byte to read.

Glossary Item Box

Read until count bytes are read, an exception is thrown, or the connection is closed.

Syntax

Visual Basic (Declaration)
Public Function ReadToCount( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim buffer() As Byte
Dim offset As Integer
Dim count As Integer
Dim value As Data

value = instance.ReadToCount(buffer, offset, count)
C#
public Data ReadToCount(
   byte[] buffer,
   int offset,
   int count
)
Managed Extensions for C++
public: Data* ReadToCount(
   byte[]* buffer,
   int offset,
   int count
)
C++/CLI
public:
Data^ ReadToCount(
   array<byte>^ buffer,
   int offset,
   int count
)

Parameters

buffer
The byte array used to store the received data.
offset
The position in the buffer to store the data.
count
The number of byte to read.

Return Value

A Data object encapsulating the received data.

Exceptions

Exception | Description
DataException | Count bytes could not be read. The DataException.DataRead property contains any data received before the failure occurred.

Remarks

If a DataException is thrown, the DataException.DataRead property contains any data received prior to the exception.

See Also

Reference

TcpBase Class
TcpBase Members


ReadToDelimiter Method

[image]
PowerTCP Mail for .NET
ReadToDelimiter Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : ReadToDelimiter Method

Glossary Item Box

Read until the delimiter is found, an exception is thrown, or the connection is closed.

Overload List

Overload | Description
ReadToDelimiter(String) | Read until the delimiter is found, an exception is thrown, or the connection is closed.
ReadToDelimiter(Byte[]) | Read until the delimiter is found, an exception is thrown, or the connection is closed.
ReadToDelimiter(String[]) | Read until a delimiter is found, an exception is thrown, or the connection is closed.
ReadToDelimiter(List<Byte[]>) | Read until a delimiter is found, an exception is thrown, or the connection is closed.

See Also

Reference

TcpBase Class
TcpBase Members


ReadToDelimiter(String) Method

[image]
PowerTCP Mail for .NET
ReadToDelimiter(String) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > ReadToDelimiter Method : ReadToDelimiter(String) Method

delimiter
A delimiter to search for.

Glossary Item Box

Read until the delimiter is found, an exception is thrown, or the connection is closed.

Syntax

Visual Basic (Declaration)
Public Overloads Function ReadToDelimiter( _
   ByVal delimiter As String _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim delimiter As String
Dim value As Data

value = instance.ReadToDelimiter(delimiter)
C#
public Data ReadToDelimiter(
   string delimiter
)
Managed Extensions for C++
public: Data* ReadToDelimiter(
   string* delimiter
)
C++/CLI
public:
Data^ ReadToDelimiter(
   String^ delimiter
)

Parameters

delimiter
A delimiter to search for.

Return Value

A Data object encapsulating the received data.

Exceptions

Exception | Description
DataException | The delimiter was not found. The DataException.DataRead property contains any data received before the failure occurred.

Remarks

This method blocks until the delimiter is found, an exception is thrown, or the server closes the connection. The value of Data.Delimiter is set to the found delimiter, if any.

If a DataException is thrown, the DataException.DataRead property contains any data received prior to the exception.

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


ReadToDelimiter(Byte[]) Method

[image]
PowerTCP Mail for .NET
ReadToDelimiter(Byte[]) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > ReadToDelimiter Method : ReadToDelimiter(Byte[]) Method

delimiter
The delimiter to search for.

Glossary Item Box

Read until the delimiter is found, an exception is thrown, or the connection is closed.

Syntax

Visual Basic (Declaration)
Public Overloads Function ReadToDelimiter( _
   ByVal delimiter() As Byte _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim delimiter() As Byte
Dim value As Data

value = instance.ReadToDelimiter(delimiter)
C#
public Data ReadToDelimiter(
   byte[] delimiter
)
Managed Extensions for C++
public: Data* ReadToDelimiter(
   byte[]* delimiter
)
C++/CLI
public:
Data^ ReadToDelimiter(
   array<byte>^ delimiter
)

Parameters

delimiter
The delimiter to search for.

Return Value

A Data object encapsulating the received data.

Exceptions

Exception | Description
DataException | The delimiter was not found. The DataException.DataRead property contains any data received before the failure occurred.

Remarks

This method blocks until the delimiter is found, an exception is thrown, or the server closes the connection. The value of Data.Delimiter is set to the found delimiter, if any.

If a DataException is thrown, the DataException.DataRead property contains any data received prior to the exception.

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


ReadToDelimiter(String[]) Method

[image]
PowerTCP Mail for .NET
ReadToDelimiter(String[]) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > ReadToDelimiter Method : ReadToDelimiter(String[]) Method

delimiters
An array of delimiters to search for.

Glossary Item Box

Read until a delimiter is found, an exception is thrown, or the connection is closed.

Syntax

Visual Basic (Declaration)
Public Overloads Function ReadToDelimiter( _
   ByVal delimiters() As String _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim delimiters() As String
Dim value As Data

value = instance.ReadToDelimiter(delimiters)
C#
public Data ReadToDelimiter(
   string[] delimiters
)
Managed Extensions for C++
public: Data* ReadToDelimiter(
   string*[]* delimiters
)
C++/CLI
public:
Data^ ReadToDelimiter(
   array<String^>^ delimiters
)

Parameters

delimiters
An array of delimiters to search for.

Return Value

Data object encapsulating the received data.

Exceptions

Exception | Description
DataException | The delimiter was not found. The DataException.DataRead property contains any data received before the failure occurred.

Remarks

This method blocks until a delimiter is found, an exception is thrown, or the server closes the connection. The value of Data.Delimiter is set to the found delimiter, if any.

If a DataException is thrown, the DataException.DataRead property contains any data received prior to the exception.

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


ReadToDelimiter(List<Byte[]>) Method

[image]
PowerTCP Mail for .NET
ReadToDelimiter(List<Byte[]>) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > ReadToDelimiter Method : ReadToDelimiter(List<Byte[]>) Method

delimiters
A list of delimiters to search for.

Glossary Item Box

Read until a delimiter is found, an exception is thrown, or the connection is closed.

Syntax

Visual Basic (Declaration)
Public Overloads Function ReadToDelimiter( _
   ByVal delimiters As List(Of Byte()) _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim delimiters As List(Of Byte())
Dim value As Data

value = instance.ReadToDelimiter(delimiters)
C#
public Data ReadToDelimiter(
   List<byte[]> delimiters
)
Managed Extensions for C++
public: Data* ReadToDelimiter(
   List<byte[]>* delimiters
)
C++/CLI
public:
Data^ ReadToDelimiter(
   List<array<byte>>^ delimiters
)

Parameters

delimiters
A list of delimiters to search for.

Return Value

A Data object encapsulating the received data.

Exceptions

Exception | Description
DataException | The delimiter was not found. The DataException.DataRead property contains any data received before the failure occurred.

Remarks

This method blocks until a delimiter is found, an exception is thrown, or the server closes the connection. The value of Data.Delimiter is set to the found delimiter, if any.

If a DataException is thrown, the DataException.DataRead property contains any data received prior to the exception.

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


ReadToEnd Method

[image]
PowerTCP Mail for .NET
ReadToEnd Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : ReadToEnd Method

Glossary Item Box

Read until the connection is closed or an exception is thrown.

Syntax

Visual Basic (Declaration)
Public Function ReadToEnd() As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As Data

value = instance.ReadToEnd()
C#
public Data ReadToEnd()
Managed Extensions for C++
public: Data* ReadToEnd();
C++/CLI
public:
Data^ ReadToEnd();

Return Value

A Data object encapsulating the received data. Returns null if the socket is closed.

Exceptions

Exception | Description
DataException | A failure occurred before the normal end of stream was found. The DataException.DataRead property contains any data received before the failure occurred.

Remarks

If a DataException is thrown, the DataException.DataRead property contains any data received prior to the exception.

See Also

Reference

TcpBase Class
TcpBase Members


ShutdownSsl Method

[image]
PowerTCP Mail for .NET
ShutdownSsl Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : ShutdownSsl Method

Glossary Item Box

Signals the remote host to shutdown the SSL connection.

Syntax

Visual Basic (Declaration)
Public Sub ShutdownSsl()
Visual Basic (Usage) Copy Code
Dim instance As TcpBase

instance.ShutdownSsl()
C#
public void ShutdownSsl()
Managed Extensions for C++
public: void ShutdownSsl();
C++/CLI
public:
void ShutdownSsl();

Remarks

This method provides a means for switching a secure connection to a non-secure connection.

See Also

Reference

TcpBase Class
TcpBase Members


Write Method

[image]
PowerTCP Mail for .NET
Write Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Write Method

Glossary Item Box

Sends data to the remote host.

Overload List

Overload | Description
Write(Byte[]) | Sends data to the remote host.
Write(String) | Sends data to the remote host.
Write(Byte[],Int32,Int32) | Sends data to the remote host.

See Also

Reference

TcpBase Class
TcpBase Members


Write(Byte[]) Method

[image]
PowerTCP Mail for .NET
Write(Byte[]) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > Write Method : Write(Byte[]) Method

buffer
Byte array of data to send.

Glossary Item Box

Sends data to the remote host.

Syntax

Visual Basic (Declaration)
Public Overloads Function Write( _
   ByVal buffer() As Byte _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim buffer() As Byte
Dim value As Data

value = instance.Write(buffer)
C#
public Data Write(
   byte[] buffer
)
Managed Extensions for C++
public: Data* Write(
   byte[]* buffer
)
C++/CLI
public:
Data^ Write(
   array<byte>^ buffer
)

Parameters

buffer
Byte array of data to send.

Return Value

A Data object encapsulating the sent data. Returns null if the socket is closed.

Remarks

This method synchronously sends data to the remote host over an existing connection. It will block until a buffer is available to accept the data or SocketOption.SendTimeout has expired.

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


Write(String) Method

[image]
PowerTCP Mail for .NET
Write(String) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > Write Method : Write(String) Method

data
String of data to send.

Glossary Item Box

Sends data to the remote host.

Syntax

Visual Basic (Declaration)
Public Overloads Function Write( _
   ByVal data As String _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim data As String
Dim value As Data

value = instance.Write(data)
C#
public Data Write(
   string data
)
Managed Extensions for C++
public: Data* Write(
   string* data
)
C++/CLI
public:
Data^ Write(
   String^ data
)

Parameters

data
String of data to send.

Return Value

A Data object encapsulating the sent data. Returns null if the socket is closed.

Remarks

This method synchronously sends data to the remote host over an existing connection. It will block until a buffer is available to accept the data or SocketOption.SendTimeout has expired.

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


Write(Byte[],Int32,Int32) Method

[image]
PowerTCP Mail for .NET
Write(Byte[],Int32,Int32) Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class > Write Method : Write(Byte[],Int32,Int32) Method

buffer
Byte array of data to send.
offset
The position in the data buffer at which to begin sending data.
count
The number of bytes to send.

Glossary Item Box

Sends data to the remote host.

Syntax

Visual Basic (Declaration)
Public Overloads Function Write( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer _
) As Data
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim buffer() As Byte
Dim offset As Integer
Dim count As Integer
Dim value As Data

value = instance.Write(buffer, offset, count)
C#
public Data Write(
   byte[] buffer,
   int offset,
   int count
)
Managed Extensions for C++
public: Data* Write(
   byte[]* buffer,
   int offset,
   int count
)
C++/CLI
public:
Data^ Write(
   array<byte>^ buffer,
   int offset,
   int count
)

Parameters

buffer
Byte array of data to send.
offset
The position in the data buffer at which to begin sending data.
count
The number of bytes to send.

Return Value

A Data object encapsulating the sent data. Returns null if the socket is closed.

Remarks

This method synchronously sends data to the remote host over an existing connection. It will block until a buffer is available to accept the data or SocketOption.SendTimeout has expired.

See Also

Reference

TcpBase Class
TcpBase Members
Overload List


WriteAsync Method

[image]
PowerTCP Mail for .NET
WriteAsync Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : WriteAsync Method

buffer
The byte array containing data to be written.
offset
The position in the buffer to start writing data from.
count
The number of bytes to write.
callback
A TcpAsyncCallback delegate referencing the method to invoke on an IO completion thread when the operation completes.
state
Object to pass into the callback method when the operation completes; can be null.

Glossary Item Box

Start an asynchronous write on the socket.

Syntax

Visual Basic (Declaration)
Public Sub WriteAsync( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer, _
   ByVal callback As TcpAsyncCallback, _
   ByVal state As Object _
)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim buffer() As Byte
Dim offset As Integer
Dim count As Integer
Dim callback As TcpAsyncCallback
Dim state As Object

instance.WriteAsync(buffer, offset, count, callback, state)
C#
public void WriteAsync(
   byte[] buffer,
   int offset,
   int count,
   TcpAsyncCallback callback,
   object state
)
Managed Extensions for C++
public: void WriteAsync(
   byte[]* buffer,
   int offset,
   int count,
   TcpAsyncCallback* callback,
   Object* state
)
C++/CLI
public:
void WriteAsync(
   array<byte>^ buffer,
   int offset,
   int count,
   TcpAsyncCallback^ callback,
   Object^ state
)

Parameters

buffer
The byte array containing data to be written.
offset
The position in the buffer to start writing data from.
count
The number of bytes to write.
callback
A TcpAsyncCallback delegate referencing the method to invoke on an IO completion thread when the operation completes.
state
Object to pass into the callback method when the operation completes; can be null.

Remarks

The TCP component is typically used by making blocking calls on a worker (non-UI) thread. This technique keeps development simple as there is no need for saving state information, but requires a dedicated thread for each connection. If a dedicated worker thread for each socket is not scalable enough, such as in server applications, developers can use Async methods which utilize IO completion ports. Async methods do not require a dedicated worker thread for each connection, and the specified callback is invoked on an IO completion thread when the operation completes. This is the best way to create a scalable, high-performance server.

See Also

Reference

TcpBase Class
TcpBase Members


TcpBase Class Properties

[image]
PowerTCP Mail for .NET
TcpBase Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : TcpBase Class

Glossary Item Box

For a list of all members of this type, see TcpBase members.

Public Properties

 | Name | Description
Public Property | CloseTime | Returns the DateTime the connection was closed.
Public Property | ConnectTime | Returns the DateTime the connection was established.
Public Property | Container | (Inherited from System.ComponentModel.Component)
Public Property | Encoding | Character encoding used by the component. (Inherited from Dart.Mail.ComponentBase)
Public Property | NetworkStream | Returns the NetworkStream object created when Connect() is called.
Public Property | RemoteEndPoint | Gets the remote address and port of the connection.
Public Property | Site | (Inherited from System.ComponentModel.Component)
Public Property | Socket | Gets the socket used by the component for communications. (Inherited from Dart.Mail.SocketBase)
Public Property | SocketOption | Gets and sets the socket options for classes derived from TcpBase.
Public Property | SslStream | Returns the SslStream object created when AuthenticateAsClient or AuthenticateAsServer are called.
Public Property | State | Gets the status of the connection as of the last socket operation.
Public Property | SynchronizingObject | Gets or sets the object used to marshal data to the UI thread (for raising events). (Inherited from Dart.Mail.ComponentBase)
Public Property | SyncRoot | Gets an object that is used to synchronize access to the upper layer protocol in use. (Inherited from Dart.Mail.ComponentBase)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.ComponentBase)
Top

Protected Properties

 | Name | Description
Protected Property | CanRaiseEvents | (Inherited from System.ComponentModel.Component)
Protected Property | DesignMode | (Inherited from System.ComponentModel.Component)
Protected Property | Events | (Inherited from System.ComponentModel.Component)
Top

See Also

Reference

TcpBase Class
Dart.Mail Namespace


CloseTime Property

[image]
PowerTCP Mail for .NET
CloseTime Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : CloseTime Property

Glossary Item Box

Returns the DateTime the connection was closed.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property CloseTime As Date
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As Date

value = instance.CloseTime
C#
public DateTime CloseTime {get;}
Managed Extensions for C++
public: __property DateTime get_CloseTime();
C++/CLI
public:
property DateTime CloseTime {
   DateTime get();
}

See Also

Reference

TcpBase Class
TcpBase Members


ConnectTime Property

[image]
PowerTCP Mail for .NET
ConnectTime Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : ConnectTime Property

Glossary Item Box

Returns the DateTime the connection was established.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property ConnectTime As Date
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As Date

value = instance.ConnectTime
C#
public DateTime ConnectTime {get;}
Managed Extensions for C++
public: __property DateTime get_ConnectTime();
C++/CLI
public:
property DateTime ConnectTime {
   DateTime get();
}

See Also

Reference

TcpBase Class
TcpBase Members


NetworkStream Property

[image]
PowerTCP Mail for .NET
NetworkStream Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : NetworkStream Property

Glossary Item Box

Returns the NetworkStream object created when Connect() is called.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property NetworkStream As NetworkStream
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As NetworkStream

value = instance.NetworkStream
C#
public NetworkStream NetworkStream {get;}
Managed Extensions for C++
public: __property NetworkStream* get_NetworkStream();
C++/CLI
public:
property NetworkStream^ NetworkStream {
   NetworkStream^ get();
}

Remarks

Returns null when no TCP connection exists.

See Also

Reference

TcpBase Class
TcpBase Members


RemoteEndPoint Property

[image]
PowerTCP Mail for .NET
RemoteEndPoint Property
See Also Example Send comments on this topic
Dart.Mail Namespace > TcpBase Class : RemoteEndPoint Property

Glossary Item Box

Gets the remote address and port of the connection.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property RemoteEndPoint As IPEndPoint
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As IPEndPoint

value = instance.RemoteEndPoint
C#
public IPEndPoint RemoteEndPoint {get;}
Managed Extensions for C++
public: __property IPEndPoint* get_RemoteEndPoint();
C++/CLI
public:
property IPEndPoint^ RemoteEndPoint {
   IPEndPoint^ get();
}

Property Value

The Socket.RemoteEndPoint. This value persists after the connection is closed.

Example

This example demonstrates using the StateChanged event and State property to update the UI.
C# Copy Code
private void myComponent_StateChanged(object sender, EventArgs e)
{
    if (myComponent.State == ConnectionState.Closed)
        this.Text = "Not Connected";
    else if (myComponent.State == ConnectionState.Connected)
        this.Text = "Connected to " + myComponent.RemoteEndPoint.ToString();
    else
        this.Text = "Securely connected to " + myComponent.RemoteEndPoint.ToString();
}
Visual Basic Copy Code
Private Sub myComponent_StateChanged(ByVal sender As Object, ByVal e As EventArgs)
    If myComponent.State = ConnectionState.Closed Then
        Me.Text = "Not Connected"
    ElseIf myComponent.State = ConnectionState.Connected Then
        Me.Text = "Connected to " & myComponent.RemoteEndPoint.ToString()
    Else
        Me.Text = "Securely connected to " & myComponent.RemoteEndPoint.ToString()
    End If
End Sub

See Also

Reference

TcpBase Class
TcpBase Members


SocketOption Property

[image]
PowerTCP Mail for .NET
SocketOption Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : SocketOption Property

Glossary Item Box

Gets and sets the socket options for classes derived from TcpBase.

Syntax

Visual Basic (Declaration)
Public Property SocketOption As TcpSocketOption
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As TcpSocketOption

instance.SocketOption = value

value = instance.SocketOption
C#
public TcpSocketOption SocketOption {get; set;}
Managed Extensions for C++
public: __property TcpSocketOption* get_SocketOption();
public: __property void set_SocketOption(
   TcpSocketOption* value
);
C++/CLI
public:
property TcpSocketOption^ SocketOption {
   TcpSocketOption^ get();
   void set (    TcpSocketOption^ value);
}

See Also

Reference

TcpBase Class
TcpBase Members


SslStream Property

[image]
PowerTCP Mail for .NET
SslStream Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : SslStream Property

Glossary Item Box

Returns the SslStream object created when AuthenticateAsClient or AuthenticateAsServer are called.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property SslStream As SslStream
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As SslStream

value = instance.SslStream
C#
public SslStream SslStream {get;}
Managed Extensions for C++
public: __property SslStream* get_SslStream();
C++/CLI
public:
property SslStream^ SslStream {
   SslStream^ get();
}

Remarks

Returns null when no secure connection exists.

See Also

Reference

TcpBase Class
TcpBase Members


State Property

[image]
PowerTCP Mail for .NET
State Property
See Also Example Send comments on this topic
Dart.Mail Namespace > TcpBase Class : State Property

Glossary Item Box

Gets the status of the connection as of the last socket operation.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property State As ConnectionState
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim value As ConnectionState

value = instance.State
C#
public ConnectionState State {get;}
Managed Extensions for C++
public: __property ConnectionState get_State();
C++/CLI
public:
property ConnectionState State {
   ConnectionState get();
}

Example

This example demonstrates using the StateChanged event and State property to update the UI.
C# Copy Code
private void myComponent_StateChanged(object sender, EventArgs e)
{
    if (myComponent.State == ConnectionState.Closed)
        this.Text = "Not Connected";
    else if (myComponent.State == ConnectionState.Connected)
        this.Text = "Connected to " + myComponent.RemoteEndPoint.ToString();
    else
        this.Text = "Securely connected to " + myComponent.RemoteEndPoint.ToString();
}
Visual Basic Copy Code
Private Sub myComponent_StateChanged(ByVal sender As Object, ByVal e As EventArgs)
    If myComponent.State = ConnectionState.Closed Then
        Me.Text = "Not Connected"
    ElseIf myComponent.State = ConnectionState.Connected Then
        Me.Text = "Connected to " & myComponent.RemoteEndPoint.ToString()
    Else
        Me.Text = "Securely connected to " & myComponent.RemoteEndPoint.ToString()
    End If
End Sub

See Also

Reference

TcpBase Class
TcpBase Members


TcpBase Class Events

[image]
PowerTCP Mail for .NET
TcpBase Class Events
See Also Send comments on this topic
Dart.Mail Namespace : TcpBase Class

Glossary Item Box

For a list of all members of this type, see TcpBase members.

Public Events

 | Name | Description
Public Event | Data | Raised when Marshal(Data,String,Object) is used.
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | Log | Raised when data is read or written.
Public Event | StateChanged | Raised when the value of the State property changes.
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

TcpBase Class
Dart.Mail Namespace


Data Event

[image]
PowerTCP Mail for .NET
Data Event
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Data Event

Glossary Item Box

Raised when Marshal(Data,String,Object) is used.

Syntax

Visual Basic (Declaration)
Public Event Data As EventHandler(Of DataEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim handler As EventHandler(Of DataEventArgs)

AddHandler instance.Data, handler
C#
public event EventHandler<DataEventArgs> Data
Managed Extensions for C++
public: __event EventHandler<DataEventArgs*>* Data
C++/CLI
public:
event EventHandler<DataEventArgs^>^ Data

Event Data

The event handler receives an argument of type DataEventArgs containing data related to this event. The following DataEventArgs properties provide information specific to this event.

Property | Description
Data | Gets data provided by Data and Log events.
Message | Returns the message argument provided by the Marshal method. (Inherited from Dart.Mail.UserStateEventArgs)
UserState | Returns the user state argument provided by the Marshal method. (Inherited from Dart.Mail.UserStateEventArgs)

Remarks

See the SynchronizingObject property for information on updating UI controls in your event handler.

See Also

Reference

TcpBase Class
TcpBase Members


Log Event

[image]
PowerTCP Mail for .NET
Log Event
See Also Example Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Log Event

Glossary Item Box

Raised when data is read or written.

Syntax

Visual Basic (Declaration)
Public Event Log As EventHandler(Of DataEventArgs)
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim handler As EventHandler(Of DataEventArgs)

AddHandler instance.Log, handler
C#
public event EventHandler<DataEventArgs> Log
Managed Extensions for C++
public: __event EventHandler<DataEventArgs*>* Log
C++/CLI
public:
event EventHandler<DataEventArgs^>^ Log

Event Data

The event handler receives an argument of type DataEventArgs containing data related to this event. The following DataEventArgs properties provide information specific to this event.

Property | Description
Data | Gets data provided by Data and Log events.
Message | Returns the message argument provided by the Marshal method. (Inherited from Dart.Mail.UserStateEventArgs)
UserState | Returns the user state argument provided by the Marshal method. (Inherited from Dart.Mail.UserStateEventArgs)

Remarks

The handler must be added before connecting. See the SynchronizingObject property for information on updating UI controls in your event handler.

Example

This example demonstrates logging sent and received data to a textbox.
C# Copy Code
private void myComponent_Log(object sender, DataEventArgs e)
{
    string prompt = (e.Data.Direction == DataDirection.In) ? "Recv: " : "Sent: ";
    textBox1.AppendText(prompt + e.Data.ToString() + Environment.NewLine);
}
Visual Basic Copy Code
Private Sub myComponent_Log(ByVal sender As Object, ByVal e As DataEventArgs)
    Dim prompt As String = If(e.Data.Direction = DataDirection.In, "Recv: ", "Sent: ")
    textBox1.AppendText(prompt & e.Data.ToString() & Environment.NewLine)
End Sub

See Also

Reference

TcpBase Class
TcpBase Members


StateChanged Event

[image]
PowerTCP Mail for .NET
StateChanged Event
See Also Example Send comments on this topic
Dart.Mail Namespace > TcpBase Class : StateChanged Event

Glossary Item Box

Raised when the value of the State property changes.

Syntax

Visual Basic (Declaration)
Public Event StateChanged As EventHandler
Visual Basic (Usage) Copy Code
Dim instance As TcpBase
Dim handler As EventHandler

AddHandler instance.StateChanged, handler
C#
public event EventHandler StateChanged
Managed Extensions for C++
public: __event EventHandler* StateChanged
C++/CLI
public:
event EventHandler^ StateChanged

Remarks

See the SynchronizingObject property for information on updating UI controls in your event handler.

This event can be raised during a Read call if the remote host closes the connection. In this scenario, a form should not be disposed of within this event handler if the Dart component was created on the form (this includes calling Form.Close if Form.Show was used to show it). Instead, the component can be created elsewhere and passed to the form, or the form can be disposed of after the posted Read returns.

Example

This example demonstrates using the StateChanged event and State property to update the UI.
C# Copy Code
private void myComponent_StateChanged(object sender, EventArgs e)
{
    if (myComponent.State == ConnectionState.Closed)
        this.Text = "Not Connected";
    else if (myComponent.State == ConnectionState.Connected)
        this.Text = "Connected to " + myComponent.RemoteEndPoint.ToString();
    else
        this.Text = "Securely connected to " + myComponent.RemoteEndPoint.ToString();
}
Visual Basic Copy Code
Private Sub myComponent_StateChanged(ByVal sender As Object, ByVal e As EventArgs)
    If myComponent.State = ConnectionState.Closed Then
        Me.Text = "Not Connected"
    ElseIf myComponent.State = ConnectionState.Connected Then
        Me.Text = "Connected to " & myComponent.RemoteEndPoint.ToString()
    Else
        Me.Text = "Securely connected to " & myComponent.RemoteEndPoint.ToString()
    End If
End Sub

See Also

Reference

TcpBase Class
TcpBase Members


TcpSession Class

[image]
PowerTCP Mail for .NET
TcpSession Class
Members See Also Send comments on this topic
Dart.Mail Namespace : TcpSession Class

Glossary Item Box

Holds the configuration used by TCP.

Object Model

TcpSession ClassIPEndPoint ClassProxy ClassIPEndPoint ClassClientSecurity Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class TcpSession
   Inherits Session
Visual Basic (Usage) Copy Code
Dim instance As TcpSession
C#
[Serializable()]
public class TcpSession : Session
Managed Extensions for C++
[Serializable()]
public __gc class TcpSession : public Session
C++/CLI
[Serializable()]
public ref class TcpSession : public Session

Inheritance Hierarchy

System.Object
Dart.Mail.Session
Dart.Mail.TcpSession
Dart.Mail.AuthenticatedSession

See Also

Reference

TcpSession Members
Dart.Mail Namespace


TcpSession Class Members

[image]
PowerTCP Mail for .NET
TcpSession Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : TcpSession Class

Glossary Item Box

The following tables list the members exposed by TcpSession.

Public Constructors

 | Name | Description
Public Constructor | TcpSession Constructor | Overloaded.
Top

Public Properties

 | Name | Description
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out.
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Proxy | Defines the optional server proxy configuration.
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the client-side SSL options. See the ClientSecurity class for more information.
Top

See Also

Reference

TcpSession Class
Dart.Mail Namespace


TcpSession Constructor

[image]
PowerTCP Mail for .NET
TcpSession Constructor
See Also Send comments on this topic
Dart.Mail Namespace > TcpSession Class : TcpSession Constructor

Glossary Item Box

Overload List

Overload | Description
TcpSession Constructor() | Default constructor for TcpSession.
TcpSession Constructor(IPEndPoint) | Constructor for TcpSession with a Remote IPEndPoint parameter.

See Also

Reference

TcpSession Class
TcpSession Members


TcpSession Constructor()

[image]
PowerTCP Mail for .NET
TcpSession Constructor()
See Also Send comments on this topic
Dart.Mail Namespace > TcpSession Class > TcpSession Constructor : TcpSession Constructor()

Glossary Item Box

Default constructor for TcpSession.

Syntax

Visual Basic (Declaration)
Public Function New()
Visual Basic (Usage) Copy Code
Dim instance As New TcpSession()
C#
public TcpSession()
Managed Extensions for C++
public: TcpSession();
C++/CLI
public:
TcpSession();

See Also

Reference

TcpSession Class
TcpSession Members
Overload List


TcpSession Constructor(IPEndPoint)

[image]
PowerTCP Mail for .NET
TcpSession Constructor(IPEndPoint)
See Also Send comments on this topic
Dart.Mail Namespace > TcpSession Class > TcpSession Constructor : TcpSession Constructor(IPEndPoint)

remoteEP
The remote IPEndPoint to connect to.

Glossary Item Box

Constructor for TcpSession with a Remote IPEndPoint parameter.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal remoteEP As IPEndPoint _
)
Visual Basic (Usage) Copy Code
Dim remoteEP As IPEndPoint

Dim instance As New TcpSession(remoteEP)
C#
public TcpSession(
   IPEndPoint remoteEP
)
Managed Extensions for C++
public: TcpSession(
   IPEndPoint* remoteEP
)
C++/CLI
public:
TcpSession(
   IPEndPoint^ remoteEP
)

Parameters

remoteEP
The remote IPEndPoint to connect to.

See Also

Reference

TcpSession Class
TcpSession Members
Overload List


TcpSession Class Properties

[image]
PowerTCP Mail for .NET
TcpSession Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : TcpSession Class

Glossary Item Box

For a list of all members of this type, see TcpSession members.

Public Properties

 | Name | Description
Public Property | ConnectTimeout | Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out.
Public Property | LocalEndPoint | EndPoint to bind to locally. (Inherited from Dart.Mail.Session)
Public Property | Proxy | Defines the optional server proxy configuration.
Public Property | RemoteEndPoint | EndPoint of the remote host to connect to. (Inherited from Dart.Mail.Session)
Public Property | Security | Specifies the client-side SSL options. See the ClientSecurity class for more information.
Top

See Also

Reference

TcpSession Class
Dart.Mail Namespace


ConnectTimeout Property

[image]
PowerTCP Mail for .NET
ConnectTimeout Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpSession Class : ConnectTimeout Property

Glossary Item Box

Gets or sets a value that specifies the amount of time (in milliseconds) after which a call to TcpBase.Connect will time out.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property ConnectTimeout As Integer
Visual Basic (Usage) Copy Code
Dim instance As TcpSession
Dim value As Integer

instance.ConnectTimeout = value

value = instance.ConnectTimeout
C#
[DefaultValue()]
public int ConnectTimeout {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_ConnectTimeout();
public: __property void set_ConnectTimeout(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int ConnectTimeout {
   int get();
   void set (    int value);
}

Property Value

The timeout value in milliseconds. The default value is -1, which defers to the system timeout.

Remarks

This property is used to cancel a connect request early; it does not override the system-level connect timeout.

See Also

Reference

TcpSession Class
TcpSession Members


Proxy Property

[image]
PowerTCP Mail for .NET
Proxy Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpSession Class : Proxy Property

Glossary Item Box

Defines the optional server proxy configuration.

Syntax

Visual Basic (Declaration)
Public Property Proxy As Proxy
Visual Basic (Usage) Copy Code
Dim instance As TcpSession
Dim value As Proxy

instance.Proxy = value

value = instance.Proxy
C#
public Proxy Proxy {get; set;}
Managed Extensions for C++
public: __property Proxy* get_Proxy();
public: __property void set_Proxy(
   Proxy* value
);
C++/CLI
public:
property Proxy^ Proxy {
   Proxy^ get();
   void set (    Proxy^ value);
}

Remarks

Use this property to define the server proxy configuration.

See Also

Reference

TcpSession Class
TcpSession Members


Security Property

[image]
PowerTCP Mail for .NET
Security Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpSession Class : Security Property

Glossary Item Box

Specifies the client-side SSL options. See the ClientSecurity class for more information.

Syntax

Visual Basic (Declaration)
Public Property Security As ClientSecurity
Visual Basic (Usage) Copy Code
Dim instance As TcpSession
Dim value As ClientSecurity

instance.Security = value

value = instance.Security
C#
public ClientSecurity Security {get; set;}
Managed Extensions for C++
public: __property ClientSecurity* get_Security();
public: __property void set_Security(
   ClientSecurity* value
);
C++/CLI
public:
property ClientSecurity^ Security {
   ClientSecurity^ get();
   void set (    ClientSecurity^ value);
}

Property Value

ClientSecurity

See Also

Reference

TcpSession Class
TcpSession Members


TcpSocketOption Class

[image]
PowerTCP Mail for .NET
TcpSocketOption Class
Members See Also Send comments on this topic
Dart.Mail Namespace : TcpSocketOption Class

Glossary Item Box

Contains socket options that may be set by TCP sockets.

Object Model

TcpSocketOption Class

Syntax

Visual Basic (Declaration)
<SerializableAttribute()>
Public Class TcpSocketOption
   Inherits SocketOption
Visual Basic (Usage) Copy Code
Dim instance As TcpSocketOption
C#
[Serializable()]
public class TcpSocketOption : SocketOption
Managed Extensions for C++
[Serializable()]
public __gc class TcpSocketOption : public SocketOption
C++/CLI
[Serializable()]
public ref class TcpSocketOption : public SocketOption

Inheritance Hierarchy

System.Object
Dart.Mail.SocketOption
Dart.Mail.TcpSocketOption

See Also

Reference

TcpSocketOption Members
Dart.Mail Namespace


TcpSocketOption Class Members

[image]
PowerTCP Mail for .NET
TcpSocketOption Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : TcpSocketOption Class

Glossary Item Box

The following tables list the members exposed by TcpSocketOption.

Public Properties

 | Name | Description
Public Property | ExclusiveAddressUse | When set to true, forbids multiple socket bindings to the same address. Set this value to true to ensure you have exclusive use of the local endpoint. Socket.ExclusiveAddressUse is set to this value before Socket.Bind is used. (Inherited from Dart.Mail.SocketOption)
Public Property | KeepAliveInterval | The time in milliseconds between retransmission of keepalives once the KeepAliveTime has expired.
Public Property | KeepAliveTime | The connection idle time in milliseconds before TCP will begin sending keepalives.
Public Property | NoDelay | Gets or sets a value that disables the use of Nagle's algorithm so that data is sent immediately.
Public Property | OutOfBandInline | Gets or sets a value that indicates whether out-of-band (urgent) data is read as normal in-line data.
Public Property | ReceiveBufferSize | Gets or sets a value that specifies the size of the system receive buffer. (Inherited from Dart.Mail.SocketOption)
Public Property | ReceiveTimeout | Overridden. Gets or sets a value that specifies the amount of time after which the underlying TCP Socket.Receive call will time out.
Public Property | ReuseAddress | When set to true, allows multiple socket bindings to the same address. Set this value to true to allow multiple sockets to bind to the same local address. (Inherited from Dart.Mail.SocketOption)
Public Property | SendBufferSize | Gets or sets a value that specifies the size of the system send buffer. (Inherited from Dart.Mail.SocketOption)
Public Property | SendTimeout | Gets or sets a value that specifies the amount of time after which the underlying Socket Send call will time out. (Inherited from Dart.Mail.SocketOption)
Top

See Also

Reference

TcpSocketOption Class
Dart.Mail Namespace


TcpSocketOption Class Properties

[image]
PowerTCP Mail for .NET
TcpSocketOption Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : TcpSocketOption Class

Glossary Item Box

For a list of all members of this type, see TcpSocketOption members.

Public Properties

 | Name | Description
Public Property | ExclusiveAddressUse | When set to true, forbids multiple socket bindings to the same address. Set this value to true to ensure you have exclusive use of the local endpoint. Socket.ExclusiveAddressUse is set to this value before Socket.Bind is used. (Inherited from Dart.Mail.SocketOption)
Public Property | KeepAliveInterval | The time in milliseconds between retransmission of keepalives once the KeepAliveTime has expired.
Public Property | KeepAliveTime | The connection idle time in milliseconds before TCP will begin sending keepalives.
Public Property | NoDelay | Gets or sets a value that disables the use of Nagle's algorithm so that data is sent immediately.
Public Property | OutOfBandInline | Gets or sets a value that indicates whether out-of-band (urgent) data is read as normal in-line data.
Public Property | ReceiveBufferSize | Gets or sets a value that specifies the size of the system receive buffer. (Inherited from Dart.Mail.SocketOption)
Public Property | ReceiveTimeout | Overridden. Gets or sets a value that specifies the amount of time after which the underlying TCP Socket.Receive call will time out.
Public Property | ReuseAddress | When set to true, allows multiple socket bindings to the same address. Set this value to true to allow multiple sockets to bind to the same local address. (Inherited from Dart.Mail.SocketOption)
Public Property | SendBufferSize | Gets or sets a value that specifies the size of the system send buffer. (Inherited from Dart.Mail.SocketOption)
Public Property | SendTimeout | Gets or sets a value that specifies the amount of time after which the underlying Socket Send call will time out. (Inherited from Dart.Mail.SocketOption)
Top

See Also

Reference

TcpSocketOption Class
Dart.Mail Namespace


KeepAliveInterval Property

[image]
PowerTCP Mail for .NET
KeepAliveInterval Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpSocketOption Class : KeepAliveInterval Property

Glossary Item Box

The time in milliseconds between retransmission of keepalives once the KeepAliveTime has expired.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property KeepAliveInterval As Integer
Visual Basic (Usage) Copy Code
Dim instance As TcpSocketOption
Dim value As Integer

instance.KeepAliveInterval = value

value = instance.KeepAliveInterval
C#
[DefaultValue()]
public int KeepAliveInterval {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_KeepAliveInterval();
public: __property void set_KeepAliveInterval(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int KeepAliveInterval {
   int get();
   void set (    int value);
}

Remarks

Once KeepAliveTime has expired, keepalives are sent every KeepAliveInterval milliseconds until a response is received, up to the maximum established by TcpMaxDataRetransmissions (OS-level configuration) before the connection is terminated. The default is 1000 (1 sec).

This property is not implemented in MONO.

See Also

Reference

TcpSocketOption Class
TcpSocketOption Members


KeepAliveTime Property

[image]
PowerTCP Mail for .NET
KeepAliveTime Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpSocketOption Class : KeepAliveTime Property

Glossary Item Box

The connection idle time in milliseconds before TCP will begin sending keepalives.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property KeepAliveTime As Integer
Visual Basic (Usage) Copy Code
Dim instance As TcpSocketOption
Dim value As Integer

instance.KeepAliveTime = value

value = instance.KeepAliveTime
C#
[DefaultValue()]
public int KeepAliveTime {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_KeepAliveTime();
public: __property void set_KeepAliveTime(
   int value
);
C++/CLI
[DefaultValue()]
public:
property int KeepAliveTime {
   int get();
   void set (    int value);
}

Remarks

Set to 0 to disable keepalives. Defaults to 7,200,000 (2 hours).

This property is not implemented in MONO.

See Also

Reference

TcpSocketOption Class
TcpSocketOption Members


NoDelay Property

[image]
PowerTCP Mail for .NET
NoDelay Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpSocketOption Class : NoDelay Property

Glossary Item Box

Gets or sets a value that disables the use of Nagle's algorithm so that data is sent immediately.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property NoDelay As Boolean
Visual Basic (Usage) Copy Code
Dim instance As TcpSocketOption
Dim value As Boolean

instance.NoDelay = value

value = instance.NoDelay
C#
[DefaultValue()]
public bool NoDelay {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_NoDelay();
public: __property void set_NoDelay(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool NoDelay {
   bool get();
   void set (    bool value);
}

Property Value

False if Nagle's algorithm is used; otherwise true. The default value is false.

Remarks

When small pieces of data (such as single bytes) are send many times consecutively, inefficient packets can be sent with one byte of useful data and 40 bytes of header information. Nagle's algorithm specifies that this type of data should be automatically concatenated and sent in a single packet. When true, Nagle's algorithm is defeated and data is immediately sent in a dedicated packet. When false, Nagle's algorithm is used and consecutive Socket Send calls might send data in a single (more efficient) packet.

Setting this property to true may result in a speed optimization (because packets are sent immediately, without having to wait to see if Send is called again). Setting this property to false results in data being transmitted more efficiently.

See Also

Reference

TcpSocketOption Class
TcpSocketOption Members


OutOfBandInline Property

[image]
PowerTCP Mail for .NET
OutOfBandInline Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpSocketOption Class : OutOfBandInline Property

Glossary Item Box

Gets or sets a value that indicates whether out-of-band (urgent) data is read as normal in-line data.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Property OutOfBandInline As Boolean
Visual Basic (Usage) Copy Code
Dim instance As TcpSocketOption
Dim value As Boolean

instance.OutOfBandInline = value

value = instance.OutOfBandInline
C#
[DefaultValue()]
public bool OutOfBandInline {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property bool get_OutOfBandInline();
public: __property void set_OutOfBandInline(
   bool value
);
C++/CLI
[DefaultValue()]
public:
property bool OutOfBandInline {
   bool get();
   void set (    bool value);
}

Property Value

True if urgent data is to be read as normal in-line data, otherwise false. The default value is false.

Remarks

When the "urgent" socket flag is set, the packet contains data that should be acted upon before "non-urgent" data. Setting this property to true will cause this urgent data to be read in-line. To minimize interoperability problems, developers are advised not to use out-of-band data unless it is required to interoperate with an existing service.

See Also

Reference

TcpSocketOption Class
TcpSocketOption Members


ReceiveTimeout Property

[image]
PowerTCP Mail for .NET
ReceiveTimeout Property
See Also Send comments on this topic
Dart.Mail Namespace > TcpSocketOption Class : ReceiveTimeout Property

Glossary Item Box

Gets or sets a value that specifies the amount of time after which the underlying TCP Socket.Receive call will time out.

Syntax

Visual Basic (Declaration)
<DefaultValueAttribute()>
Public Overrides Property ReceiveTimeout As Integer
Visual Basic (Usage) Copy Code
Dim instance As TcpSocketOption
Dim value As Integer

instance.ReceiveTimeout = value

value = instance.ReceiveTimeout
C#
[DefaultValue()]
public override int ReceiveTimeout {get; set;}
Managed Extensions for C++
[DefaultValue()]
public: __property int get_ReceiveTimeout() override;
public: __property void set_ReceiveTimeout(
   int value
) override;
C++/CLI
[DefaultValue()]
public:
property int ReceiveTimeout {
   int get() override;
   void set (    int value) override;
}

Property Value

The time-out value in milliseconds. The default value is 0, which indicates an infinite time-out period.

Remarks

Values between 1 and 499 will be changed to 500, as 500 is the minimum positive value. A value of 0 or -1 indicates an infinite time-out period.

See Also

Reference

TcpSocketOption Class
TcpSocketOption Members


Textpart Class

[image]
PowerTCP Mail for .NET
Textpart Class
Members Example See Also Send comments on this topic
Dart.Mail Namespace : Textpart Class

Glossary Item Box

Implements a part used to encapsulate Unicode characters.

Object Model

Textpart ClassContentDisposition ClassContentType ClassHeaderDictionary ClassHeaderField Class

Syntax

Visual Basic (Declaration)
Public Class Textpart
   Inherits Resource
Visual Basic (Usage) Copy Code
Dim instance As Textpart
C#
public class Textpart : Resource
Managed Extensions for C++
public __gc class Textpart : public Resource
C++/CLI
public ref class Textpart : public Resource

Remarks

ContentType.MediaType is initialized to "text/plain" or "text/html".

Example

This example demonstrates how to add parts to a message. First, a "multipartalternative" part containing two alternative text parts is added. Second, a resource part containing an image is added.
C# Copy Code
private MailMessage addCustomParts(MailMessage message)
{
    //Add custom header field to message
    message.Headers.Add("X-Alt-Message", new HeaderField("X-Alt-Message", "Message with Alternatives"));

    //Create and add alternative parts to a multipart part
    Textpart part1 = new Textpart("This is alternative 1.");
    part1.Headers.Add("X-Alt", new HeaderField("X-Alt", "Alternative 1"));

    Textpart part2 = new Textpart("This is alternative 2.");
    part2.Headers.Add("X-Alt", new HeaderField("X-Alt", "Alternative 2"));

    Multipart multipart = new Multipart(Multipart.Alternative);
    multipart.Parts.Add(part1);
    multipart.Parts.Add(part2);

    //Add a MultiPart to the MailMessage
    message.Parts.Add(multipart);

    //Add a Resource part to the MailMessage
    Resource resource = new Resource(new FileStream(Application.StartupPath + "\\myImage.jpg", FileMode.Open), "myImage.jpg");
    resource.ContentType = new ContentType("image/jpeg");
    resource.ContentId = "<myImage>";
    message.Parts.Add(resource);
    return message;
}
Visual Basic Copy Code
Private Function addCustomParts(ByVal message As MailMessage) As MailMessage
    'Add custom header field to message
    message.Headers.Add("X-Alt-Message", New HeaderField("X-Alt-Message", "Message with Alternatives"))

    'Create and add alternative parts to a multipart part
    Dim part1 As New Textpart("This is alternative 1.")
    part1.Headers.Add("X-Alt", New HeaderField("X-Alt", "Alternative 1"))

    Dim part2 As New Textpart("This is alternative 2.")
    part2.Headers.Add("X-Alt", New HeaderField("X-Alt", "Alternative 2"))

    Dim multipart As New Multipart(Dart.Mail.Multipart.Alternative)
    multipart.Parts.Add(part1)
    multipart.Parts.Add(part2)

    'Add a MultiPart to the MailMessage
    message.Parts.Add(multipart)

    'Add a Resource part to the MailMessage
    Dim resource As New Resource(New FileStream(Application.StartupPath & "\myImage.jpg", FileMode.Open), "myImage.jpg")
    resource.ContentType = New ContentType("image/jpeg")
    resource.ContentId = "<myImage>"
    message.Parts.Add(resource)
    Return message
End Function

Inheritance Hierarchy

System.Object
Dart.Mail.Part
Dart.Mail.Resource
Dart.Mail.Textpart
Dart.Mail.Htmlpart

See Also

Reference

Textpart Members
Dart.Mail Namespace


Textpart Class Members

[image]
PowerTCP Mail for .NET
Textpart Class Members
See Also Properties Methods Send comments on this topic
Dart.Mail Namespace : Textpart Class

Glossary Item Box

The following tables list the members exposed by Textpart.

Public Constructors

 | Name | Description
Public Constructor | Textpart Constructor | Constructor used to create a Textpart.
Top

Public Properties

 | Name | Description
Public Property | Content | Sets or gets text content. Returns null if not initialized.
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part. (Inherited from Dart.Mail.Resource)
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part. (Inherited from Dart.Mail.Resource)
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Encoding | The encoding to be used for text.
Public Property | Headers | Provides a Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part. (Inherited from Dart.Mail.Resource)
Top

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values. (Inherited from Dart.Mail.Resource)
Public Method | Clone | Overridden. Creates a deep copy of the Textpart.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content. (Inherited from Dart.Mail.Resource)
Public Method | Dispose | Overloaded. Releases all resources associated with the object. (Inherited from Dart.Mail.Part)
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Resource)
Public Method | GetContentStream | Overridden. Gets a MemoryStream that has been filled with encoded Content.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType. (Inherited from Dart.Mail.Resource)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Textpart Class
Dart.Mail Namespace


Textpart Constructor

[image]
PowerTCP Mail for .NET
Textpart Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Textpart Class : Textpart Constructor

content
String value used to initialize Content.

Glossary Item Box

Constructor used to create a Textpart.

Syntax

Visual Basic (Declaration)
Public Function New( _
   ByVal content As String _
)
Visual Basic (Usage) Copy Code
Dim content As String

Dim instance As New Textpart(content)
C#
public Textpart(
   string content
)
Managed Extensions for C++
public: Textpart(
   string* content
)
C++/CLI
public:
Textpart(
   String^ content
)

Parameters

content
String value used to initialize Content.

Remarks

Content must be null when decoding (the encoding Stream is being written to), and not null when encoding (the encoding Stream is being read from).

See Also

Reference

Textpart Class
Textpart Members


Textpart Class Methods

[image]
PowerTCP Mail for .NET
Textpart Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : Textpart Class

Glossary Item Box

For a list of all members of this type, see Textpart members.

Public Methods

 | Name | Description
Public Method | Clear | Reinitializes the part to default (empty) values. (Inherited from Dart.Mail.Resource)
Public Method | Clone | Overridden. Creates a deep copy of the Textpart.
Public Method | ContentToArray | Gets a byte[] that contains decoded byte content. (Inherited from Dart.Mail.Resource)
Public Method | Dispose | Overloaded. Releases all resources associated with the object. (Inherited from Dart.Mail.Part)
Public Method | GetContentEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Resource)
Public Method | GetContentStream | Overridden. Gets a MemoryStream that has been filled with encoded Content.
Public Method | GetDecodingExceptions | Returns Exceptions created during decoding. (Inherited from Dart.Mail.Part)
Public Method | GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used. (Inherited from Dart.Mail.Part)
Public Method | GetMediaTypeFromExtension | Parses the extension from the provided path and uses it to return a string suitable for use as ContentType.MediaType. (Inherited from Dart.Mail.Resource)
Public Method | ToArray | Returns the encoded MIME entity as a byte array. (Inherited from Dart.Mail.Part)
Public Method | ToString | Overloaded. Returns the MIME entity as a String. (Inherited from Dart.Mail.Part)
Top

See Also

Reference

Textpart Class
Dart.Mail Namespace


Clone Method

[image]
PowerTCP Mail for .NET
Clone Method
See Also Send comments on this topic
Dart.Mail Namespace > Textpart Class : Clone Method

Glossary Item Box

Creates a deep copy of the Textpart.

Syntax

Visual Basic (Declaration)
Public Overrides Function Clone() As Object
Visual Basic (Usage) Copy Code
Dim instance As Textpart
Dim value As Object

value = instance.Clone()
C#
public override object Clone()
Managed Extensions for C++
public: Object* Clone(); override
C++/CLI
public:
Object^ Clone(); override

Return Value

A Textpart

See Also

Reference

Textpart Class
Textpart Members


GetContentStream Method

[image]
PowerTCP Mail for .NET
GetContentStream Method
See Also Send comments on this topic
Dart.Mail Namespace > Textpart Class : GetContentStream Method

Glossary Item Box

Gets a MemoryStream that has been filled with encoded Content.

Syntax

Visual Basic (Declaration)
Public Overrides Function GetContentStream() As Stream
Visual Basic (Usage) Copy Code
Dim instance As Textpart
Dim value As Stream

value = instance.GetContentStream()
C#
public override Stream GetContentStream()
Managed Extensions for C++
public: Stream* GetContentStream(); override
C++/CLI
public:
Stream^ GetContentStream(); override

Remarks

Set Content to specify the source of the data for this encoding. If Content is null, then an expandable MemoryStream is created for subsequent decoding (using Write).

See Also

Reference

Textpart Class
Textpart Members


Textpart Class Properties

[image]
PowerTCP Mail for .NET
Textpart Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Textpart Class

Glossary Item Box

For a list of all members of this type, see Textpart members.

Public Properties

 | Name | Description
Public Property | Content | Sets or gets text content. Returns null if not initialized.
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part. (Inherited from Dart.Mail.Resource)
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part. (Inherited from Dart.Mail.Resource)
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Encoding | The encoding to be used for text.
Public Property | Headers | Provides a Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Overridden. Returns the approximate Length of the encoded part.
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part. (Inherited from Dart.Mail.Resource)
Top

See Also

Reference

Textpart Class
Dart.Mail Namespace


Content Property

[image]
PowerTCP Mail for .NET
Content Property
See Also Send comments on this topic
Dart.Mail Namespace > Textpart Class : Content Property

Glossary Item Box

Sets or gets text content. Returns null if not initialized.

Syntax

Visual Basic (Declaration)
Public Shadows Property Content As String
Visual Basic (Usage) Copy Code
Dim instance As Textpart
Dim value As String

instance.Content = value

value = instance.Content
C#
public new string Content {get; set;}
Managed Extensions for C++
public: __property new string* get_Content();
public: __property new void set_Content(
   string* value
);
C++/CLI
public:
new property String^ Content {
   String^ get();
   void set (    String^ value);
}

Remarks

When set, if Encoding is ASCII and the new value contains a non-ASCII character, then Encoding is set to Headers.Encoding and Resource.TransferEncoding is set to TransferEncoding.QuotedPrintable. This default behavior can be overridden by setting these properties explicitly.

When read, if Encoding is ASCII and an 8-bit character is found, then the part body is searched for "charset=". If a valid charset is found then Encoding is updated and used for decoding, otherwise Encoding.Default is used. This behavior can be overridden by setting Encoding explicitly.

Content must be null when decoding (the encoding Stream is being written to), and not null when encoding (the encoding Stream is being read from).

See Also

Reference

Textpart Class
Textpart Members


Encoding Property

[image]
PowerTCP Mail for .NET
Encoding Property
See Also Send comments on this topic
Dart.Mail Namespace > Textpart Class : Encoding Property

Glossary Item Box

The encoding to be used for text.

Syntax

Visual Basic (Declaration)
Public Property Encoding As Encoding
Visual Basic (Usage) Copy Code
Dim instance As Textpart
Dim value As Encoding

instance.Encoding = value

value = instance.Encoding
C#
public Encoding Encoding {get; set;}
Managed Extensions for C++
public: __property Encoding* get_Encoding();
public: __property void set_Encoding(
   Encoding* value
);
C++/CLI
public:
property Encoding^ Encoding {
   Encoding^ get();
   void set (    Encoding^ value);
}

Remarks

ContentType.CharSet maps to System.Text.Encoding.WebName. If CharSet is not set, System.Text.Encoding.ASCII is used unless 8-bit Content is found, in which case Part.EncodingMap["default"] is used for encoding. Consider using System.Text.Encoding.UTF8 if full Unicode support is desired.

See EncodingMap for help with decoding using undefined charset values. Unrecognized charset strings map to Part.EncodingMap["default"] and are reported using Part.DecodingExceptions.

See Also

Reference

Textpart Class
Textpart Members


Length Property

[image]
PowerTCP Mail for .NET
Length Property
See Also Send comments on this topic
Dart.Mail Namespace > Textpart Class : Length Property

Glossary Item Box

Returns the approximate Length of the encoded part.

Syntax

Visual Basic (Declaration)
Public Overrides ReadOnly Property Length As Long
Visual Basic (Usage) Copy Code
Dim instance As Textpart
Dim value As Long

value = instance.Length
C#
public override long Length {get;}
Managed Extensions for C++
public: __property long get_Length() override;
C++/CLI
public:
property int64 Length {
   int64 get() override;
}

See Also

Reference

Textpart Class
Textpart Members


UserStateEventArgs Class

[image]
PowerTCP Mail for .NET
UserStateEventArgs Class
Members See Also Send comments on this topic
Dart.Mail Namespace : UserStateEventArgs Class

Glossary Item Box

Provides data for UserState. Base class for EventArgs that have Message and UserState properties.

Object Model

UserStateEventArgs Class

Syntax

Visual Basic (Declaration)
Public Class UserStateEventArgs
   Inherits System.EventArgs
Visual Basic (Usage) Copy Code
Dim instance As UserStateEventArgs
C#
public class UserStateEventArgs : System.EventArgs
Managed Extensions for C++
public __gc class UserStateEventArgs : public System.EventArgs
C++/CLI
public ref class UserStateEventArgs : public System.EventArgs

Inheritance Hierarchy

System.Object
System.EventArgs
Dart.Mail.UserStateEventArgs
Dart.Mail.DataEventArgs

See Also

Reference

UserStateEventArgs Members
Dart.Mail Namespace


UserStateEventArgs Class Members

[image]
PowerTCP Mail for .NET
UserStateEventArgs Class Members
See Also Properties Send comments on this topic
Dart.Mail Namespace : UserStateEventArgs Class

Glossary Item Box

The following tables list the members exposed by UserStateEventArgs.

Public Properties

 | Name | Description
Public Property | Message | Returns the message argument provided by the Marshal method.
Public Property | UserState | Returns the user state argument provided by the Marshal method.
Top

See Also

Reference

UserStateEventArgs Class
Dart.Mail Namespace


UserStateEventArgs Class Properties

[image]
PowerTCP Mail for .NET
UserStateEventArgs Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : UserStateEventArgs Class

Glossary Item Box

For a list of all members of this type, see UserStateEventArgs members.

Public Properties

 | Name | Description
Public Property | Message | Returns the message argument provided by the Marshal method.
Public Property | UserState | Returns the user state argument provided by the Marshal method.
Top

See Also

Reference

UserStateEventArgs Class
Dart.Mail Namespace


Message Property

[image]
PowerTCP Mail for .NET
Message Property
See Also Send comments on this topic
Dart.Mail Namespace > UserStateEventArgs Class : Message Property

Glossary Item Box

Returns the message argument provided by the Marshal method.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Message As String
Visual Basic (Usage) Copy Code
Dim instance As UserStateEventArgs
Dim value As String

value = instance.Message
C#
public string Message {get;}
Managed Extensions for C++
public: __property string* get_Message();
C++/CLI
public:
property String^ Message {
   String^ get();
}

See Also

Reference

UserStateEventArgs Class
UserStateEventArgs Members


UserState Property

[image]
PowerTCP Mail for .NET
UserState Property
See Also Send comments on this topic
Dart.Mail Namespace > UserStateEventArgs Class : UserState Property

Glossary Item Box

Returns the user state argument provided by the Marshal method.

Syntax

Visual Basic (Declaration)
Public ReadOnly Property UserState As Object
Visual Basic (Usage) Copy Code
Dim instance As UserStateEventArgs
Dim value As Object

value = instance.UserState
C#
public object UserState {get;}
Managed Extensions for C++
public: __property Object* get_UserState();
C++/CLI
public:
property Object^ UserState {
   Object^ get();
}

See Also

Reference

UserStateEventArgs Class
UserStateEventArgs Members


Authentication Enumeration

[image]
PowerTCP Mail for .NET
Authentication Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : Authentication Enumeration

Glossary Item Box

Enumerates the values of MailSession.Authentication.

Syntax

Visual Basic (Declaration)
Public Enum Authentication
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As Authentication
C#
public enum Authentication : System.Enum
Managed Extensions for C++
__value public enum Authentication : public System.Enum
C++/CLI
public enum class Authentication : public System.Enum

Members

Member | Description
Apop | 2nd-least secure POP authentication (Pop only).
Auto | Chooses an authentication mechanism in order of preference: CRAM-MD5, LOGIN, PLAIN, GSSAPI, NTLM, (APOP), (None/ClearText).
ClearText | Login performed in the clear (non-SASL Imap LOGIN or Pop USER/PASS). Least secure.
CramMD5 | CRAM-MD5 authentication described in RFC 2195.
GssApi | GSSAPI/SSPI authentication. Not supported under Mono on systems without secur32.dll (Linux, etc).
Login | SASL LOGIN authentication.
None | No authentication used (Smtp only).
Ntlm | NTLM authentication. Not supported under Mono on systems without secur32.dll (Linux, etc).
OAuth2 | OAuth2 authentication.
Plain | PLAIN authentication described in RFC 2595.

Remarks

Authentication.Auto chooses an authentication mechanism from MailBase.Capabilities in order of preference: CRAM-MD5, (SASL) LOGIN, PLAIN, GSSAPI and NTLM. Pop uses APOP as the lowest preference. If no capabilities are advertised, Smtp uses Authentication.None and Imap/Pop uses Authentication.ClearText (non-SASL Imap LOGIN or Pop USER/PASS). If no credentials are specified, Smtp uses Authentication.None. OAuth2 must be specified manually, as it requires application-level implementation; see the top-level OAuth help topic for more information.

GssApi and Ntlm provide a "single sign-on" capability if MailSession.Username is empty (uses the credentials of the current Windows user account); otherwise MailSession.Username, MailSession.Password, and MailSession.Domain will be used for authentication.

OAuth2 can be used by all mail protocols. See the top-level OAuth help topic for more information.

Authentication protocols that the server supports are listed in MailBase.Capabilities.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.Authentication

See Also

Reference

Dart.Mail Namespace


ConnectionState Enumeration

[image]
PowerTCP Mail for .NET
ConnectionState Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : ConnectionState Enumeration

Glossary Item Box

Enumerates the possible values of the connection state.

Syntax

Visual Basic (Declaration)
Public Enum ConnectionState
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As ConnectionState
C#
public enum ConnectionState : System.Enum
Managed Extensions for C++
__value public enum ConnectionState : public System.Enum
C++/CLI
public enum class ConnectionState : public System.Enum

Members

Member | Description
Closed | The connection is closed.
Connected | The TCP connection is established but not secure.
ConnectedAndSecure | The connection is connected and secure.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.ConnectionState

See Also

Reference

Dart.Mail Namespace


DataDirection Enumeration

[image]
PowerTCP Mail for .NET
DataDirection Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : DataDirection Enumeration

Glossary Item Box

Enumerates the direction of data flow.

Syntax

Visual Basic (Declaration)
Public Enum DataDirection
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As DataDirection
C#
public enum DataDirection : System.Enum
Managed Extensions for C++
__value public enum DataDirection : public System.Enum
C++/CLI
public enum class DataDirection : public System.Enum

Members

Member | Description
In | Data was received (using the Read method).
Out | Data was sent (using the Write method).

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.DataDirection

See Also

Reference

Dart.Mail Namespace


DigestAlgorithm Enumeration

[image]
PowerTCP Mail for .NET
DigestAlgorithm Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : DigestAlgorithm Enumeration

Glossary Item Box

Algorithms used to sign (hash) an S/MIME message.

Syntax

Visual Basic (Declaration)
Public Enum DigestAlgorithm
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As DigestAlgorithm
C#
public enum DigestAlgorithm : System.Enum
Managed Extensions for C++
__value public enum DigestAlgorithm : public System.Enum
C++/CLI
public enum class DigestAlgorithm : public System.Enum

Members

Member | Description
Md5 | MD5 algorithm.
Sha1 | SHA-1 algorithm.
Sha256 | SHA-256 algorithm.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.DigestAlgorithm

See Also

Reference

Dart.Mail Namespace


Encrypt Enumeration

[image]
PowerTCP Mail for .NET
Encrypt Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : Encrypt Enumeration

Glossary Item Box

Enumerates the techniques used to establish SSL connections.

Syntax

Visual Basic (Declaration)
Public Enum Encrypt
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As Encrypt
C#
public enum Encrypt : System.Enum
Managed Extensions for C++
__value public enum Encrypt : public System.Enum
C++/CLI
public enum class Encrypt : public System.Enum

Members

Member | Description
Explicit | Encryption should be negotiated using a protocol-specific technique.
Implicit | Encryption should be negotiated immediately after establishing the control connection with the server.
None | No encryption is to be used.

Remarks

With implicit security, it is understood that both the client and the server will use SSL for the entire session. The client connects, the SSL handshake occurs, and (if successful) secure communication continues for the session. For this reason, implicit SSL typically must use a different well-known port (FTP SSL uses 990, IMAP SSL uses 993, etc.).

With explicit security, secure communication occurs only after some preliminary clear-text negotiation completes. The client connects normally to the server using the well-known port and issues a command requesting SSL use. If the server supports the mechanism and responds positively, secure communication is negotiated.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.Encrypt

See Also

Reference

Dart.Mail Namespace


EncryptingAlgorithm Enumeration

[image]
PowerTCP Mail for .NET
EncryptingAlgorithm Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : EncryptingAlgorithm Enumeration

Glossary Item Box

Possible symmetric algorithms used to encrypt an S/MIME message.

Syntax

Visual Basic (Declaration)
Public Enum EncryptingAlgorithm
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As EncryptingAlgorithm
C#
public enum EncryptingAlgorithm : System.Enum
Managed Extensions for C++
__value public enum EncryptingAlgorithm : public System.Enum
C++/CLI
public enum class EncryptingAlgorithm : public System.Enum

Members

Member | Description
Aes128 | 128 bit AES encryption.
Aes192 | 192 bit AES encryption.
Aes256 | 256 bit AES encryption.
Des | DES encryption.
Rc2_128 | 128 bit RC2 encryption.
Rc2_40 | 40 bit RC2 encryption.
Rc2_64 | 64 bit RC2 encryption.
Rc4 | RC4 encryption.
TripleDes | TripleDES (3DES) encryption.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.EncryptingAlgorithm

See Also

Reference

Dart.Mail Namespace


ForwardFormat Enumeration

[image]
PowerTCP Mail for .NET
ForwardFormat Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : ForwardFormat Enumeration

Glossary Item Box

The supported formats used for forwarding an existing message.

Syntax

Visual Basic (Declaration)
Public Enum ForwardFormat
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As ForwardFormat
C#
public enum ForwardFormat : System.Enum
Managed Extensions for C++
__value public enum ForwardFormat : public System.Enum
C++/CLI
public enum class ForwardFormat : public System.Enum

Members

Member | Description
Alternative | A "multipart/alternative" message is created, with the original message's parts cloned, included as the second part (as a Multipart). This format is used by Apple Mail, among others.
Attachment | A "multipart/mixed" message is created, with the original message included as the second part (as an Attachment). No content is cloned.
Redirect

The original MailMessage is cloned with a new Textpart inserted as the first part, containing the comment.

If MailMessage.ReplyTo is null, it is set to the original MailMessage.From, so any reply made to the redirected message will be sent to the originator.

Standard | The original message is copied, with its parts cloned. The comment is prepended to Multipart.Text and Multipart.Html. This format is used by Microsoft LiveMail, among others.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.ForwardFormat

See Also

Reference

Dart.Mail Namespace


ImapCode Enumeration

[image]
PowerTCP Mail for .NET
ImapCode Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : ImapCode Enumeration

Glossary Item Box

Represents IMAP response codes.

Syntax

Visual Basic (Declaration)
Public Enum ImapCode
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As ImapCode
C#
public enum ImapCode : System.Enum
Managed Extensions for C++
__value public enum ImapCode : public System.Enum
C++/CLI
public enum class ImapCode : public System.Enum

Members

Member | Description
Alert | The response contains an alert which must be shown to the user.
BadCharset | A SEARCH operation failed due to an unsupported charset.
Capability | The response contains a list of IMAP server capabilities. This type of response also populates MailBase.Capabilities.
NewName | An operation failed because the Mailbox was renamed.
None | No response code provided.
Parse | An error occurred during the parsing of message headers.
PermanentFlags | The response contains a list of all flags that can be changed permanently within the mailbox and its messages. Any flags not on this list should not be set. A value of "\*" means new, non-standard flags can be created.
ReadOnly | The selected mailbox is read-only.
ReadWrite | The selected mailbox is read-write.
TryCreate | An executing command failed because the target mailbox does not exist. The target mailbox may need to be created prior to issuing the command that failed.
UidNext | The response includes the UIDNEXT value for the selected mailbox, indicating the UID of the next created message.
UidValidity | The response includes the UIDVALIDITY value for the selected mailbox. This value can be used in combination with message UIDs to uniquely identify messages between sessions.
Unseen | Indicates the number (position id) of the first unseen message in the selected mailbox.

Remarks

This enumeration represents the code returned in an IMAP server response. Response codes are optional and contain additional information beyond status. See ImapResponse.Code.

For example, if the server response is

* OK [UIDVALIDITY 3857529045] UIDs valid

ImapResponse.Code is ImapCode.UidValidity.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.ImapCode

See Also

Reference

Dart.Mail Namespace


ImapCriterion Enumeration

[image]
PowerTCP Mail for .NET
ImapCriterion Enumeration
Example See Also Send comments on this topic
Dart.Mail Namespace : ImapCriterion Enumeration

Glossary Item Box

Details criterion for the IMAP SEARCH command.

Syntax

Visual Basic (Declaration)
Public Enum ImapCriterion
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As ImapCriterion
C#
public enum ImapCriterion : System.Enum
Managed Extensions for C++
__value public enum ImapCriterion : public System.Enum
C++/CLI
public enum class ImapCriterion : public System.Enum

Members

Member | Description
All | Search for all messages (no restrictions). No search parameter is required.
Answered | Search for all answered messages (messages that have the Answered flag set). No search parameter is required.
Bcc | Search for messages that contain the specified string in the BCC field of the message envelope.
Before | Search for messages with an earlier internal date than the specified date.
Body | Search for messages that contain the specified string in the message body.
Cc | Search for messages that contain the specified string in the CC field of the message envelope.
Deleted | Search for deleted messages (messages that have the Deleted flag set). No search parameter is required.
Draft | Search for draft messages (messages that have the Draft flag set). No search parameter is required.
Flagged | Search for flagged messages (messages that have the Flagged flag set). No search parameter is required.
From | Search for messages that contain the specified string in the FROM field of the message envelope.
Header | Search for messages that contain the specified string in the message header. Note that the format requires that the header field be specified, so the parameter value for this search criterion should be "<header> <value>".
Keyword | Search for messages that have the specified keyword flag set. This allows for searches based on custom flag types.
Larger | Search for messages larger than the specified byte count.
New | Search for all recent and unseen messages (messages with the Recent flag set but not the Seen flag). No search parameter is required.
Not | Perform a logical inversion (NOT operation) on another search criterion. No search parameter is required if this is part of a collection of ImapSearchParameters and another search criterion follows this one; otherwise, a search parameter is required.
NotAnswered | Search for messages that do not have the Answered flag set. No search parameter is required.
NotDeleted | Search for messages that do not have the Deleted flag set. No search parameter is required.
NotDraft | Search for messages that do not have the Draft flag set. No search parameter is required.
NotFlagged | Search for messages that do not have the Flagged flag set. No search parameter is required.
NotKeyword | Search for messages that do not have the specified keyword flag set. This allows for searches based on custom flag types.
NotSeen | Search for messages that do not have the Seen flag set. No search parameter is required.
Old | Search for messages that do not have the Recent flag set. No search parameter is required.
On | Search for messages that have an internal date that exactly matches the value specified (disregarding time).
Or | Perform a logical OR operation on the two search criterion that follow this one. This search parameter must be followed by two other search parameters; these will represent the conditions to be ORed.
Recent | Search for recent messages (messages that have the Recent flag set). No search parameter is required.
Seen | Search for seen messages (messages that have the Seen flag set). No search parameter is required.
SentBefore | Search for messages sent before the specified date.
SentOn | Search for messages sent on the specified date.
SentSince | Search for messages with an internal date later than the specified date.
Since | Search for messages sent after the specified date.
Smaller | Search for messages smaller than the specified byte count.
Subject | Search for messages that contain the specified string in the message subject.
Text | Search for messages that contain the specified string in either the header or body of the message.
To | Search for messages that contain the specified string in the TO field of the message.
Uid | Search for messages that match the UID or range of UIDs specified. Ranges of UIDs can be specified using the format "<start>:<end>".

Remarks

This enumeration specifies search restrictions for the Mailbox.Search method. Use this enumeration with the ImapSearchParameter class to create custom searches of an IMAP mailbox.

Example

In this example, the Imap component copies messages that match a specified criteria to another mailbox.
C# Copy Code
private void getMessages(object state)
{
    //Configure server and account info
    imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session));
    imap1.Session.Username = myUsername;
    imap1.Session.Password = myPassword;

    //Connect and log into the account
    imap1.Connect();
    imap1.Authenticate();

    //Set the selected mailbox to the Inbox
    imap1.SelectedMailbox = imap1.Mailboxes["INBOX"];

    // Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON"
    ImapSearchParameter[] criteria = new ImapSearchParameter[]
    {
        new ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"),
        new ImapSearchParameter(ImapCriterion.Not, ""),
        new ImapSearchParameter(ImapCriterion.From, "JACKSON")
    };

    // Perform the search
    ImapMessage[] messages = imap1.SelectedMailbox.Search(criteria);

    //Copy all messages that meet the criteria to the 'Save' mailbox
    foreach (ImapMessage imapMessage in messages)
        imapMessage.CopyTo(imap1.Mailboxes["Save"]);

    //Gracefully logout
    imap1.Close();
}
Visual Basic Copy Code
Private Sub getMessages(ByVal state As Object)
    'Configure server and account info
    imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session))
    imap1.Session.Username = myUsername
    imap1.Session.Password = myPassword

    'Connect and log into the account
    imap1.Connect()
    imap1.Authenticate()

    'Set the selected mailbox to the Inbox
    imap1.SelectedMailbox = imap1.Mailboxes("INBOX")

    ' Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON"
    Dim criteria() As ImapSearchParameter = { New ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"), New ImapSearchParameter(ImapCriterion.Not, ""), New ImapSearchParameter(ImapCriterion.From, "JACKSON") }

    ' Perform the search
    Dim messages() As ImapMessage = imap1.SelectedMailbox.Search(criteria)

    'Copy all messages that meet the criteria to the 'Save' mailbox
    For Each imapMessage As ImapMessage In messages
        imapMessage.CopyTo(imap1.Mailboxes("Save"))
    Next imapMessage

    'Gracefully logout
    imap1.Close()
End Sub

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.ImapCriterion

See Also

Reference

Dart.Mail Namespace


ImapFlags Enumeration

[image]
PowerTCP Mail for .NET
ImapFlags Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : ImapFlags Enumeration

Glossary Item Box

Represents IMAP flags.

Syntax

Visual Basic (Declaration)
<FlagsAttribute()>
Public Enum ImapFlags
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As ImapFlags
C#
[Flags()]
public enum ImapFlags : System.Enum
Managed Extensions for C++
[Flags()]
__value public enum ImapFlags : public System.Enum
C++/CLI
[Flags()]
public enum class ImapFlags : public System.Enum

Members

Member | Description
Answered | A message was replied to. This flag is managed entirely by the IMAP client.
Deleted | A message should be deleted when the next EXPUNGE operation occurs. This flag is managed entirely by the IMAP client, but it is used by the IMAP server during an EXPUNGE operation.
Draft | The composition of a message has not been finished. This flag is managed entirely by the IMAP client.
Flagged | A message has been marked for special attention. This flag is managed entirely by the IMAP client.
None | No flags. Clear all message flags.
Seen | A message has been read. This flag is managed by both the client and the server. The server updates the flag when FETCH operations occur.

Remarks

Mailbox.Update and ImapMessage.Update uses this enumeration to update one or more message flags.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.ImapFlags

See Also

Reference

Dart.Mail Namespace


ImapMessageInfo Enumeration

[image]
PowerTCP Mail for .NET
ImapMessageInfo Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : ImapMessageInfo Enumeration

Glossary Item Box

Represents the section(s) of an IMAP message when partial messages are retrieved.

Syntax

Visual Basic (Declaration)
<FlagsAttribute()>
Public Enum ImapMessageInfo
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As ImapMessageInfo
C#
[Flags()]
public enum ImapMessageInfo : System.Enum
Managed Extensions for C++
[Flags()]
__value public enum ImapMessageInfo : public System.Enum
C++/CLI
[Flags()]
public enum class ImapMessageInfo : public System.Enum

Members

Member | Description
Date | Retrieve the internal date of the message, when it was received by the server. Populates ImapMessage.Date.
Empty | Message is not populated.
Envelope | Retrieve the IMAP envelope. Populates Date, Subject, From, To, Cc, Bcc, Sender, ReplyTo, Headers[HeaderKey.MessageID], and Headers[HeaderKey.InReplyTo] on ImapMessage.Message.
Fast | An enum value combination preset. Retrieves message flags, internal date, and size.
Flags | Retrieve the message flags. Populates Answered, Deleted, Draft, Flagged, Recent, and Seen.
Full | An enum value combination preset. Retrieves message flags, internal date, size, envelope, and body.
Header | Retrieve the message headers. Populates ImapMessage.Message.Headers, which sets Date, Subject, From, To, Cc, Bcc, Sender, and ReplyTo on ImapMessage.Message.
Message | Retrieve the entire message. Populates ImapMessage.Message.
Size | Retrieve the length of the encoded message, in bytes. Populates ImapMessage.Size.
Structure | Retrieve the parsed body structure of the message. Populates ImapMessage.Message.Parts with empty parts of the applicable type.
Text | Retrieve the text of the message, if applicable. Typicially populates ImapMessage.Message.Text.
Uid | Retrieve the unique ID (UID) of the message. Populates ImapMessage.Uid.

Remarks

This enumeration represents sections of an IMAP message. IMAP allows partial message retrieval, and this enumeration specifies which section(s) should be retrieved. Values are additive; one or more values can be passed to ImapMessage.Get() and Mailbox.Get().

When requesting ImapMessageInfo.Text for MIME messages, the server's response will be used to create a new Textpart. If the server's response includes multiple MIME parts, request ImapMessageInfo.Headers and ImapMessageInfo.Text to parse the data into separate parts.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.ImapMessageInfo

See Also

Reference

Dart.Mail Namespace


ImapStatus Enumeration

[image]
PowerTCP Mail for .NET
ImapStatus Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : ImapStatus Enumeration

Glossary Item Box

Enumerates IMAP status codes.

Syntax

Visual Basic (Declaration)
Public Enum ImapStatus
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As ImapStatus
C#
public enum ImapStatus : System.Enum
Managed Extensions for C++
__value public enum ImapStatus : public System.Enum
C++/CLI
public enum class ImapStatus : public System.Enum

Members

Member | Description
Bad | Error. Indicates the command was not properly formed (the command syntax was incorrect). Otherwise, this response is considered a protocol-level error or server failure.
Bye | Shutdown. Indicates the server is about to close the connection to the client. This can occur during logout, inactivity, or as a server warning.
No | Failure. Indicates an unsuccessful command. Otherwise, this response is considered a warning.
None | No status information provided.
Ok | Success. Indicates a successful command completion. Otherwise, this response is informative. Success can vary in meaning depending on the command executed. For example, a COPY operation (Mailbox.Copy) returns an OK response even when no messages are copied. Review the behavior of the operation in question for further details.
PreAuth | Preauthorization. Through some external mechanism, authentication occurred without a login, and login is unnecessary.

Remarks

This enumeration reflects an IMAP server response status. Typically, status responses come after commands are executed, but not all responses provide status. ImapResponse.ResponseType is ImapResponseType.Status when the response provides status. See ImapResponse.Status.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.ImapStatus

See Also

Reference

Dart.Mail Namespace


PopMessageInfo Enumeration

[image]
PowerTCP Mail for .NET
PopMessageInfo Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : PopMessageInfo Enumeration

Glossary Item Box

Enumerates the possible values of PopMessage.Info.

Syntax

Visual Basic (Declaration)
Public Enum PopMessageInfo
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As PopMessageInfo
C#
public enum PopMessageInfo : System.Enum
Managed Extensions for C++
__value public enum PopMessageInfo : public System.Enum
C++/CLI
public enum class PopMessageInfo : public System.Enum

Members

Member | Description
BodyLines | The Message has been initialized with a specified number of body lines.
Empty | The Message has not been initialized.
Message | The Message has been fully populated.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.PopMessageInfo

See Also

Reference

Dart.Mail Namespace


Priority Enumeration

[image]
PowerTCP Mail for .NET
Priority Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : Priority Enumeration

Glossary Item Box

Possible values of MailMessage.Priority.

Syntax

Visual Basic (Declaration)
Public Enum Priority
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As Priority
C#
public enum Priority : System.Enum
Managed Extensions for C++
__value public enum Priority : public System.Enum
C++/CLI
public enum class Priority : public System.Enum

Members

Member | Description
High | Indicates a high priority message (numerical value of 2).
Highest | Indicates a highest priority message (numerical value of 1).
Low | Indicates a low priority message (numerical value of 4).
Lowest | Indicates a lowest priority message (numerical value of 5).
None | Indicates no "Priority" header field is used. Mail readers interpret this as normal priority.
Normal | Indicates a normal priority message (numerical value of 3).

Remarks

Some email clients will visually mark message priority for easier identification.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.Priority

See Also

Reference

Dart.Mail Namespace


ProxyType Enumeration

[image]
PowerTCP Mail for .NET
ProxyType Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : ProxyType Enumeration

Glossary Item Box

Enumerates the provided proxy support that can be used.

Syntax

Visual Basic (Declaration)
Public Enum ProxyType
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As ProxyType
C#
public enum ProxyType : System.Enum
Managed Extensions for C++
__value public enum ProxyType : public System.Enum
C++/CLI
public enum class ProxyType : public System.Enum

Members

Member | Description
Http | An HTTP server proxy is to be used.
None | No server proxy is to be used.
Socks4 | A SOCKS4 server proxy is to be used.
Socks5 | A SOCKS5 server proxy is to be used.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.ProxyType

See Also

Reference

Dart.Mail Namespace


SecureEncoding Enumeration

[image]
PowerTCP Mail for .NET
SecureEncoding Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : SecureEncoding Enumeration

Glossary Item Box

Possible S/MIME encoding exposed by the message (which may have multiple nested encodings). Only the exposed encoding is known.

Syntax

Visual Basic (Declaration)
Public Enum SecureEncoding
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As SecureEncoding
C#
public enum SecureEncoding : System.Enum
Managed Extensions for C++
__value public enum SecureEncoding : public System.Enum
C++/CLI
public enum class SecureEncoding : public System.Enum

Members

Member | Description
Encrypted | The message is encrypted (enveloped).
None | The message has no S/MIME encoding.
Signed | The message is signed with a digital signature.
SignedDetached | The message is signed with a detached digital signature. This form of encoding leaves the message body in clear text, allowing mail agents who are not S/MIME-capable to still view the message.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.SecureEncoding

See Also

Reference

Dart.Mail Namespace


TransferEncoding Enumeration

[image]
PowerTCP Mail for .NET
TransferEncoding Enumeration
See Also Send comments on this topic
Dart.Mail Namespace : TransferEncoding Enumeration

Glossary Item Box

Enumerates the transfer encoding algorithms used on part content.

Syntax

Visual Basic (Declaration)
Public Enum TransferEncoding
   Inherits System.Enum
Visual Basic (Usage) Copy Code
Dim instance As TransferEncoding
C#
public enum TransferEncoding : System.Enum
Managed Extensions for C++
__value public enum TransferEncoding : public System.Enum
C++/CLI
public enum class TransferEncoding : public System.Enum

Members

Member | Description
Base64 | Base64 encoding is not readable.
Binary | Adds "Content-Transfer-Encoding: binary" header line. No encoding/decoding is performed. A "binary" path is assumed to the destination. A transfer-encoding of "binary" indicates the 8bit data does not observe RFC 822 line-length restrictions (an image file is a good example). RFC 3030 describes how to send this type of data.
EightBit | Adds "Content-Transfer-Encoding: 8bit" header line. No encoding/decoding is performed. An "8bit" path is assumed to the destination. A transfer-encoding of "8bit" indicates the 8bit data observes RFC 822 line-length restrictions (UTF8 encoding with line breaks is a good example). RFC 6152 describe how to send this type of data.
None | No encoding is marked. This is perfectly suitable for 7-bit ASCII text.
QuotedPrintable | Quoted-Printable encoding maximizes the readability of text that has some 8-bit characters.
SevenBit | Adds "Content-Transfer-Encoding: 7bit" header line. No encoding/decoding is performed.
Uuencode | UUEncode ("UNIX to UNIX") encoding. Not normally used, but may be used to decode legacy message formats.

Remarks

The SMTP protocol was originally designed to handle only 7-bit data. Later, the protocol was extended to support 8-bit data as well by using MIME encoding. This enumeration specifies the encoding algorithm used to transform the data from 8-bit data to 7-bit data. Mail readers use this information to decode the received (encoded) data into it's original (decoded) form.

Inheritance Hierarchy

System.Object
System.ValueType
System.Enum
Dart.Mail.TransferEncoding

See Also

Reference

Dart.Mail Namespace


TcpAsyncCallback Delegate

[image]
PowerTCP Mail for .NET
TcpAsyncCallback Delegate
See Also Send comments on this topic
Dart.Mail Namespace : TcpAsyncCallback Delegate

tcp
The TcpBase object that initiated the asynchronous operation.
data
The Data object containing received/sent data. Null for connect operations or if the socket is closed.
exception
Populated if the operation threw an exception, otherwise null.
state
State object passed into the asynchronous call.

Glossary Item Box

References the method to invoke on an IO completion thread when the corresponding asynchronous operation completes.

Syntax

Visual Basic (Declaration)
Public Delegate Sub TcpAsyncCallback( _
   ByVal tcp As TcpBase, _
   ByVal data As Data, _
   ByVal exception As Exception, _
   ByVal state As Object _
)
Visual Basic (Usage) Copy Code
Dim instance As New TcpAsyncCallback(AddressOf HandlerMethod)
C#
public delegate void TcpAsyncCallback(
   TcpBase tcp,
   Data data,
   Exception exception,
   object state
)
Managed Extensions for C++
public: __gc __delegate void TcpAsyncCallback(
   TcpBase* tcp,
   Data* data,
   Exception* exception,
   Object* state
)
C++/CLI
public delegate void TcpAsyncCallback(
   TcpBase^ tcp,
   Data^ data,
   Exception^ exception,
   Object^ state
)

Parameters

tcp
The TcpBase object that initiated the asynchronous operation.
data
The Data object containing received/sent data. Null for connect operations or if the socket is closed.
exception
Populated if the operation threw an exception, otherwise null.
state
State object passed into the asynchronous call.

See Also

Reference

TcpAsyncCallback Members
Dart.Mail Namespace


Assembly Overview

Dart.Mail Assembly
See Also Send comments on this topic

Glossary Item Box

Namespaces

Namespace | Description
Dart.Mail |


Getting Started - PowerTCP Mail for .NET

Getting Started
Send comments on this topic

Glossary Item Box


Introduction - PowerTCP Mail for .NET

Introduction
Send comments on this topic

Glossary Item Box


DartLicenseException Class Events

[image]
PowerTCP Mail for .NET
DartLicenseException Class Events
See Also Send comments on this topic
Dart.Mail Namespace : DartLicenseException Class

Glossary Item Box

For a list of all members of this type, see DartLicenseException members.

Protected Events

 | Name | Description
Protected Event | SerializeObjectState | (Inherited from System.Exception)
Top

See Also

Reference

DartLicenseException Class
Dart.Mail Namespace


DartLicenseException Class Methods

[image]
PowerTCP Mail for .NET
DartLicenseException Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : DartLicenseException Class

Glossary Item Box

For a list of all members of this type, see DartLicenseException members.

Public Methods

 | Name | Description
Public Method | GetBaseException | (Inherited from System.Exception)
Public Method | GetObjectData | (Inherited from System.Exception)
Public Method | GetType | (Inherited from System.Exception)
Public Method | ToString | (Inherited from System.Exception)
Top

See Also

Reference

DartLicenseException Class
Dart.Mail Namespace


DartLicenseException Class Properties

[image]
PowerTCP Mail for .NET
DartLicenseException Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : DartLicenseException Class

Glossary Item Box

For a list of all members of this type, see DartLicenseException members.

Public Properties

 | Name | Description
Public Property | Data | (Inherited from System.Exception)
Public Property | HelpLink | (Inherited from System.Exception)
Public Property | HResult | (Inherited from System.Exception)
Public Property | InnerException | (Inherited from System.Exception)
Public Property | Message | (Inherited from System.Exception)
Public Property | Source | (Inherited from System.Exception)
Public Property | StackTrace | (Inherited from System.Exception)
Public Property | TargetSite | (Inherited from System.Exception)
Top

See Also

Reference

DartLicenseException Class
Dart.Mail Namespace


DataException Class Events

[image]
PowerTCP Mail for .NET
DataException Class Events
See Also Send comments on this topic
Dart.Mail Namespace : DataException Class

Glossary Item Box

For a list of all members of this type, see DataException members.

Protected Events

 | Name | Description
Protected Event | SerializeObjectState | (Inherited from System.Exception)
Top

See Also

Reference

DataException Class
Dart.Mail Namespace


DataException Class Methods

[image]
PowerTCP Mail for .NET
DataException Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : DataException Class

Glossary Item Box

For a list of all members of this type, see DataException members.

Public Methods

 | Name | Description
Public Method | GetBaseException | (Inherited from System.Exception)
Public Method | GetObjectData | (Inherited from System.Exception)
Public Method | GetType | (Inherited from System.Exception)
Public Method | ToString | (Inherited from System.Exception)
Top

See Also

Reference

DataException Class
Dart.Mail Namespace


DataException Class Properties

[image]
PowerTCP Mail for .NET
DataException Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : DataException Class

Glossary Item Box

For a list of all members of this type, see DataException members.

Public Properties

 | Name | Description
Public Property | Data | (Inherited from System.Exception)
Public Property | HelpLink | (Inherited from System.Exception)
Public Property | HResult | (Inherited from System.Exception)
Public Property | InnerException | (Inherited from System.Exception)
Public Property | Message | (Inherited from System.Exception)
Public Property | Source | (Inherited from System.Exception)
Public Property | StackTrace | (Inherited from System.Exception)
Public Property | TargetSite | (Inherited from System.Exception)
Top

See Also

Reference

DataException Class
Dart.Mail Namespace


HeaderField Constructor

[image]
PowerTCP Mail for .NET
HeaderField Constructor
See Also Send comments on this topic
Dart.Mail Namespace > HeaderField Class : HeaderField Constructor

Glossary Item Box

Overload List

Overload | Description
HeaderField Constructor | Initializes Name, Body, Value and Parameters.

See Also

Reference

HeaderField Class
HeaderField Members


Htmlpart Class Properties

[image]
PowerTCP Mail for .NET
Htmlpart Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : Htmlpart Class

Glossary Item Box

For a list of all members of this type, see Htmlpart members.

Public Properties

 | Name | Description
Public Property | Content | Sets or gets text content. Returns null if not initialized. (Inherited from Dart.Mail.Textpart)
Public Property | ContentDisposition | Gets or sets the ContentDisposition values associated with this part. (Inherited from Dart.Mail.Resource)
Public Property | ContentId | Links this resource to a root html part within a "multipart/related" part. (Inherited from Dart.Mail.Resource)
Public Property | ContentType | Gets or sets the "Content-Type" header field for the part. (Inherited from Dart.Mail.Part)
Public Property | Encoding | The encoding to be used for text. (Inherited from Dart.Mail.Textpart)
Public Property | Headers | Provides a Part.Headers instance that lists all unique header fields. (Inherited from Dart.Mail.Part)
Public Property | Length | Returns the approximate Length of the encoded part. (Inherited from Dart.Mail.Textpart)
Public Property | Tag | Gets or sets an object that stores any user data. (Inherited from Dart.Mail.Part)
Public Property | TransferEncoding | Gets or sets the TransferEncoding value ("content-transfer-encoding") associated with this part. (Inherited from Dart.Mail.Resource)
Top

See Also

Reference

Htmlpart Class
Dart.Mail Namespace


Htmlpart Constructor

[image]
PowerTCP Mail for .NET
Htmlpart Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Htmlpart Class : Htmlpart Constructor

Glossary Item Box

Overload List

Overload | Description
Htmlpart Constructor | Constructor used to create an Htmlpart.

See Also

Reference

Htmlpart Class
Htmlpart Members


ImapSession Class Methods

[image]
PowerTCP Mail for .NET
ImapSession Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ImapSession Class

Glossary Item Box

For a list of all members of this type, see ImapSession members.

Public Methods

 | Name | Description
Public Method | Clone | Creates a deep copy of the Session. (Inherited from Dart.Mail.MailSession)
Top

See Also

Reference

ImapSession Class
Dart.Mail Namespace


ImapUTF7 Class Properties

[image]
PowerTCP Mail for .NET
ImapUTF7 Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ImapUTF7 Class

Glossary Item Box

For a list of all members of this type, see ImapUTF7 members.

Public Properties

 | Name | Description
Public Property | BodyName | (Inherited from System.Text.Encoding)
Public Property | CodePage | (Inherited from System.Text.Encoding)
Public Property | DecoderFallback | (Inherited from System.Text.Encoding)
Public Property | EncoderFallback | (Inherited from System.Text.Encoding)
Public Property | EncodingName | (Inherited from System.Text.Encoding)
Public Property | HeaderName | (Inherited from System.Text.Encoding)
Public Property | IsBrowserDisplay | (Inherited from System.Text.Encoding)
Public Property | IsBrowserSave | (Inherited from System.Text.Encoding)
Public Property | IsMailNewsDisplay | (Inherited from System.Text.Encoding)
Public Property | IsMailNewsSave | (Inherited from System.Text.Encoding)
Public Property | IsReadOnly | (Inherited from System.Text.Encoding)
Public Property | IsSingleByte | (Inherited from System.Text.Encoding)
Public Property | WebName | (Inherited from System.Text.Encoding)
Public Property | WindowsCodePage | (Inherited from System.Text.Encoding)
Top

See Also

Reference

ImapUTF7 Class
Dart.Mail Namespace


IPEndPoint Class Methods

[image]
PowerTCP Mail for .NET
IPEndPoint Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : IPEndPoint Class

Glossary Item Box

For a list of all members of this type, see IPEndPoint members.

Public Methods

 | Name | Description
Public Method | Create | (Inherited from System.Net.IPEndPoint)
Public Method | Equals | (Inherited from System.Net.IPEndPoint)
Public Method | GetHashCode | (Inherited from System.Net.IPEndPoint)
Public Method | Serialize | (Inherited from System.Net.IPEndPoint)
Public Method | ToString | (Inherited from System.Net.IPEndPoint)
Top

See Also

Reference

IPEndPoint Class
Dart.Mail Namespace


MailBase Class Events

[image]
PowerTCP Mail for .NET
MailBase Class Events
See Also Send comments on this topic
Dart.Mail Namespace : MailBase Class

Glossary Item Box

For a list of all members of this type, see MailBase members.

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

MailBase Class
Dart.Mail Namespace


Find Method

[image]
PowerTCP Mail for .NET
Find Method
See Also Send comments on this topic
Dart.Mail Namespace > MailboxCollection Class : Find Method

Glossary Item Box

Overload List

Overload | Description
Find(Predicate{Mailbox}) | (Inherited from System.Collections.Generic.List<Mailbox>)

See Also

Reference

MailboxCollection Class
MailboxCollection Members


MailSecurity Class Fields

[image]
PowerTCP Mail for .NET
MailSecurity Class Fields
See Also Send comments on this topic
Dart.Mail Namespace : MailSecurity Class

Glossary Item Box

For a list of all members of this type, see MailSecurity members.

Public Fields

 | Name | Description
Public Field | SelectionCallback | The delegate that executes to permit selection of a cient certificate. (Inherited from Dart.Mail.ClientSecurity)
Public Field | ValidationCallback | The delegate that executes after the server provides its certificate to the client. (Inherited from Dart.Mail.Security)
Top

See Also

Reference

MailSecurity Class
Dart.Mail Namespace


PartCollection<T> Class Properties

[image]
PowerTCP Mail for .NET
PartCollection<T> Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : PartCollection<T> Class

Glossary Item Box

For a list of all members of this type, see PartCollection<T> members.

Public Properties

 | Name | Description
Public Property | Capacity | (Inherited from System.Collections.Generic.List<T>)
Public Property | Count | (Inherited from System.Collections.Generic.List<T>)
Public Property | Item | (Inherited from System.Collections.Generic.List<T>)
Top

See Also

Reference

PartCollection<T> Class
Dart.Mail Namespace


Remove Method

[image]
PowerTCP Mail for .NET
Remove Method
See Also Send comments on this topic
Dart.Mail Namespace > PartCollection<T> Class : Remove Method

Glossary Item Box

Removes the specified part from the message.

Overload List

Overload | Description
Remove | Removes the specified part from the message.

See Also

Reference

PartCollection<T> Class
PartCollection<T> Members


GetEncodingStream Method

[image]
PowerTCP Mail for .NET
GetEncodingStream Method
See Also Send comments on this topic
Dart.Mail Namespace > Part Class : GetEncodingStream Method

Glossary Item Box

Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.

Overload List

Overload | Description
GetEncodingStream | Returns a Stream that encodes when System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32) is used and decodes when System.IO.Stream.Write(System.Byte[],System.Int32,System.Int32) is used.

See Also

Reference

Part Class
Part Members


PipelineSendException Class Events

[image]
PowerTCP Mail for .NET
PipelineSendException Class Events
See Also Send comments on this topic
Dart.Mail Namespace : PipelineSendException Class

Glossary Item Box

For a list of all members of this type, see PipelineSendException members.

Protected Events

 | Name | Description
Protected Event | SerializeObjectState | (Inherited from System.Exception)
Top

See Also

Reference

PipelineSendException Class
Dart.Mail Namespace


PipelineSendException Class Methods

[image]
PowerTCP Mail for .NET
PipelineSendException Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : PipelineSendException Class

Glossary Item Box

For a list of all members of this type, see PipelineSendException members.

Public Methods

 | Name | Description
Public Method | GetBaseException | (Inherited from System.Exception)
Public Method | GetObjectData | (Inherited from System.Exception)
Public Method | GetType | (Inherited from System.Exception)
Public Method | ToString | (Inherited from System.Exception)
Top

See Also

Reference

PipelineSendException Class
Dart.Mail Namespace


PopMessageCollection Class Methods

[image]
PowerTCP Mail for .NET
PopMessageCollection Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : PopMessageCollection Class

Glossary Item Box

For a list of all members of this type, see PopMessageCollection members.

Public Methods

 | Name | Description
Public Method | Add | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | AddRange | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | AsReadOnly | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | BinarySearch | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Clear | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Contains | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | ConvertAll | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | CopyTo | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Exists | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Find | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | FindAll | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | FindIndex | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | FindLast | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | FindLastIndex | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | ForEach | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | GetEnumerator | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | GetRange | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | IndexOf | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Insert | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | InsertRange | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | LastIndexOf | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Remove | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | RemoveAll | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | RemoveAt | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | RemoveRange | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Reverse | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | Sort | Overloaded. (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | ToArray | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | TrimExcess | (Inherited from System.Collections.Generic.List<PopMessage>)
Public Method | TrueForAll | (Inherited from System.Collections.Generic.List<PopMessage>)
Top

See Also

Reference

PopMessageCollection Class
Dart.Mail Namespace


ProtocolException Class Events

[image]
PowerTCP Mail for .NET
ProtocolException Class Events
See Also Send comments on this topic
Dart.Mail Namespace : ProtocolException Class

Glossary Item Box

For a list of all members of this type, see ProtocolException members.

Protected Events

 | Name | Description
Protected Event | SerializeObjectState | (Inherited from System.Exception)
Top

See Also

Reference

ProtocolException Class
Dart.Mail Namespace


ProtocolException Class Methods

[image]
PowerTCP Mail for .NET
ProtocolException Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : ProtocolException Class

Glossary Item Box

For a list of all members of this type, see ProtocolException members.

Public Methods

 | Name | Description
Public Method | GetBaseException | (Inherited from System.Exception)
Public Method | GetObjectData | (Inherited from System.Exception)
Public Method | GetType | (Inherited from System.Exception)
Public Method | ToString | (Inherited from System.Exception)
Top

See Also

Reference

ProtocolException Class
Dart.Mail Namespace


ProtocolException Class Properties

[image]
PowerTCP Mail for .NET
ProtocolException Class Properties
See Also Send comments on this topic
Dart.Mail Namespace : ProtocolException Class

Glossary Item Box

For a list of all members of this type, see ProtocolException members.

Public Properties

 | Name | Description
Public Property | Data | (Inherited from System.Exception)
Public Property | HelpLink | (Inherited from System.Exception)
Public Property | HResult | (Inherited from System.Exception)
Public Property | InnerException | (Inherited from System.Exception)
Public Property | Message | (Inherited from System.Exception)
Public Property | Source | (Inherited from System.Exception)
Public Property | StackTrace | (Inherited from System.Exception)
Public Property | TargetSite | (Inherited from System.Exception)
Top

See Also

Reference

ProtocolException Class
Dart.Mail Namespace


ProtocolException Constructor

[image]
PowerTCP Mail for .NET
ProtocolException Constructor
See Also Send comments on this topic
Dart.Mail Namespace > ProtocolException Class : ProtocolException Constructor

Glossary Item Box

Overload List

Overload | Description
ProtocolException Constructor | Initializes a new ProtocolException.

See Also

Reference

ProtocolException Class
ProtocolException Members


SmtpSession Class Methods

[image]
PowerTCP Mail for .NET
SmtpSession Class Methods
See Also Send comments on this topic
Dart.Mail Namespace : SmtpSession Class

Glossary Item Box

For a list of all members of this type, see SmtpSession members.

Public Methods

 | Name | Description
Public Method | Clone | Creates a deep copy of the Session. (Inherited from Dart.Mail.MailSession)
Top

See Also

Reference

SmtpSession Class
Dart.Mail Namespace


SocketBase Class Events

[image]
PowerTCP Mail for .NET
SocketBase Class Events
See Also Send comments on this topic
Dart.Mail Namespace : SocketBase Class

Glossary Item Box

For a list of all members of this type, see SocketBase members.

Public Events

 | Name | Description
Public Event | Disposed | (Inherited from System.ComponentModel.Component)
Public Event | Error | Raised when Marshal(Exception) is used or an unhandled Exception is thrown in a worker thread created using Start. (Inherited from Dart.Mail.ComponentBase)
Public Event | UserState | Raised when Marshal(String,Object) is used. (Inherited from Dart.Mail.ComponentBase)
Top

See Also

Reference

SocketBase Class
Dart.Mail Namespace


Close Method

[image]
PowerTCP Mail for .NET
Close Method
See Also Send comments on this topic
Dart.Mail Namespace > TcpBase Class : Close Method

Glossary Item Box

Gracefully closes the connection.

Overload List

Overload | Description
Close | Gracefully closes the connection.

See Also

Reference

TcpBase Class
TcpBase Members


Textpart Constructor

[image]
PowerTCP Mail for .NET
Textpart Constructor
See Also Send comments on this topic
Dart.Mail Namespace > Textpart Class : Textpart Constructor

Glossary Item Box

Overload List

Overload | Description
Textpart Constructor | Constructor used to create a Textpart.

See Also

Reference

Textpart Class
Textpart Members


Dart.Mail Namespace Inheritance Hierarchy

Dart.Mail Namespace Inheritance Hierarchy
See Also Send comments on this topic

Glossary Item Box

Inheritance Hierarchy

System.Object
Dart.Mail.DeliveryStatusNotification
Dart.Mail.HeaderField
Dart.Mail.HeaderKey
Dart.Mail.ImapResponse
Dart.Mail.ImapSearchParameter
Dart.Mail.MessageBase
Dart.Mail.ImapMessage
Dart.Mail.PopMessage
Dart.Mail.Part
Dart.Mail.Multipart
Dart.Mail.MailMessage
Dart.Mail.Resource
Dart.Mail.Attachment
Dart.Mail.Messagepart
Dart.Mail.Textpart
Dart.Mail.Htmlpart
Dart.Mail.Proxy
Dart.Mail.Recipient
Dart.Mail.Security
Dart.Mail.ClientSecurity
Dart.Mail.MailSecurity
Dart.Mail.Segment
Dart.Mail.Data
Dart.Mail.Session
Dart.Mail.TcpSession
Dart.Mail.AuthenticatedSession
Dart.Mail.MailSession
Dart.Mail.ImapSession
Dart.Mail.SmtpSession
Dart.Mail.SmtpResult
Dart.Mail.SocketOption
Dart.Mail.TcpSocketOption
System.Collections.Generic.Dictionary<TKey,TValue>
Dart.Mail.HeaderDictionary
System.Collections.Generic.List<T>
Dart.Mail.Mailbox
Dart.Mail.MailboxCollection
Dart.Mail.MultipartContent
Dart.Mail.PartCollection<T>
Dart.Mail.PopMessageCollection
System.EventArgs
Dart.Mail.ErrorEventArgs
Dart.Mail.ImapAlertEventArgs
Dart.Mail.ImapUpdateEventArgs
Dart.Mail.ProgressEventArgs
Dart.Mail.ImapProgressEventArgs
Dart.Mail.PopProgressEventArgs
Dart.Mail.SmtpProgressEventArgs
Dart.Mail.UserStateEventArgs
Dart.Mail.DataEventArgs
System.Exception
Dart.Mail.DartLicenseException
System.ApplicationException
Dart.Mail.DataException
Dart.Mail.PipelineSendException
Dart.Mail.ProtocolException
System.MarshalByRefObject
System.ComponentModel.Component
Dart.Mail.ComponentBase
Dart.Mail.MailBase
Dart.Mail.Imap
Dart.Mail.Pop
Dart.Mail.Smtp
Dart.Mail.SocketBase
Dart.Mail.TcpBase
System.Net.EndPoint
System.Net.IPEndPoint
Dart.Mail.IPEndPoint
System.Net.Mime.ContentDisposition
Dart.Mail.ContentDisposition
System.Net.Mime.ContentType
Dart.Mail.ContentType
System.Text.Encoding
Dart.Mail.ImapUTF7

See Also

Reference

Dart.Mail Assembly