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




Gets or sets the SMTP server port.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Behavior")>
<DefaultValueAttribute()>
<DescriptionAttribute("The port on the server that messages are sent to")>
Public Property ServerPort As Integer
Visual Basic (Usage)Copy Code
Dim instance As Smtp
Dim value As Integer
 
instance.ServerPort = value
 
value = instance.ServerPort
C# 
[CategoryAttribute("Behavior")]
[DefaultValueAttribute()]
[DescriptionAttribute("The port on the server that messages are sent to")]
public int ServerPort {get; set;}
Managed Extensions for C++ 
[CategoryAttribute("Behavior")]
[DefaultValueAttribute()]
[DescriptionAttribute("The port on the server that messages are sent to")]
public: __property int get_ServerPort();
public: __property void set_ServerPort( 
   int value
);
C++/CLI 
[CategoryAttribute("Behavior")]
[DefaultValueAttribute()]
[DescriptionAttribute("The port on the server that messages are sent to")]
public:
property int ServerPort {
   int get();
   void set (    int value);
}

Property Value

An integer value representing the port of the SMTP server to which the connection will be made. Defaults to 25.

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

Used to identify the SMTP server port, which is the "well-known" port 25 by convention. The object always checks this property, so you can change it at any time and subsequent sessions will be automatically established with the correct port.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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