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




Gets or sets the SMTP server hostname or address.

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("The Server that messages are sent to.")>
<CategoryAttribute("Behavior")>
<DefaultValueAttribute()>
Public Property Server As String
Visual Basic (Usage)Copy Code
Dim instance As Smtp
Dim value As String
 
instance.Server = value
 
value = instance.Server
C# 
[DescriptionAttribute("The Server that messages are sent to.")]
[CategoryAttribute("Behavior")]
[DefaultValueAttribute()]
public string Server {get; set;}
Managed Extensions for C++ 
[DescriptionAttribute("The Server that messages are sent to.")]
[CategoryAttribute("Behavior")]
[DefaultValueAttribute()]
public: __property string* get_Server();
public: __property void set_Server( 
   string* value
);
C++/CLI 
[DescriptionAttribute("The Server that messages are sent to.")]
[CategoryAttribute("Behavior")]
[DefaultValueAttribute()]
public:
property String^ Server {
   String^ get();
   void set (    String^ value);
}

Property Value

A string value representing the SMTP server to which the connection will be made.

Example

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

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

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

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

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

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

' Specify the subject
msg.Subject = "Hello"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Remarks

Used to identify the SMTP resource either by hostname (that is resolved by DNS) or dot address (of the form 11.22.33.44). The object always checks this property, so you can change it at any time and subsequent sessions will be automatically established with the correct server.

The Smtp component was designed to automatically log in to the server when any communication with the server needs to take place. In order for this to occur the Smtp.Server property has to be set to valid values. Once this has been done, the user will be automatically logged in transparently. If the mail server is listening on a port outside of the RFC specification (i.e., not port 25) this can be set using the Smtp.Connection.Connect.

You must set the Smtp.Server property before proper use.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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