PowerTCP Mail for .NET
ClientPort Property
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Smtp Class : ClientPort Property




Gets or sets the client port when a specific local port is desired.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Behavior")>
<DescriptionAttribute("The port this client is operating on")>
<DefaultValueAttribute()>
Public Property ClientPort As Integer
Visual Basic (Usage)Copy Code
Dim instance As Smtp
Dim value As Integer
 
instance.ClientPort = value
 
value = instance.ClientPort
C# 
[CategoryAttribute("Behavior")]
[DescriptionAttribute("The port this client is operating on")]
[DefaultValueAttribute()]
public int ClientPort {get; set;}
Managed Extensions for C++ 
[CategoryAttribute("Behavior")]
[DescriptionAttribute("The port this client is operating on")]
[DefaultValueAttribute()]
public: __property int get_ClientPort();
public: __property void set_ClientPort( 
   int value
);
C++/CLI 
[CategoryAttribute("Behavior")]
[DescriptionAttribute("The port this client is operating on")]
[DefaultValueAttribute()]
public:
property int ClientPort {
   int get();
   void set (    int value);
}

Property Value

An integer value indicating the client port to use when a specific local port is desired; 0 indicates that any port can be used. The default is 0.

Example

The following example demonstrates use of the Smtp component when dealing with a client or server which does not use common protocol settings.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

' Set the username (usually not required).
Smtp1.Username = "myusername"

' Set the password (usually not required).
Smtp1.Password = "mypass"

' Set the client interface (this overrides the default interface)
Smtp1.Client = "111.222.111.222"
Smtp1.ClientPort = 8123

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

' Set the server port (this defaults to 25, the well-known port for SMTP)
Smtp1.ServerPort = 9876

' Send a message
Smtp1.Send("you@test.com", "me@test.com", "test", "test message")
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// Set the username (usually not required).
smtp1.Username = "myusername";

// Set the password (usually not required).
smtp1.Password = "mypass";

// Set the client interface (this overrides the default interface)
smtp1.Client = "111.222.111.222";
smtp1.ClientPort = 8123;

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

// Set the server port (this defaults to 25, the well-known port for SMTP)
smtp1.ServerPort = 9876;

// Send a message
smtp1.Send("you@test.com", "me@test.com", "test", "test message");

Remarks

Set this property to any value between 1 and 65535 to specify the local port for the connection. This property is often useful if for some reason the client machine is limited in the ports that can be used to make connections. This is often the case in intranet environments where client are restricted or firewalled for security purposes.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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