| Visual Basic (Declaration) | |
|---|---|
Public Property Text As String | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As MessageStream 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 ); | |
Property Value
A string representing the text for the message, if any is present.The following example demonstrates creating a basic MIME message with a single attachment.
| Visual Basic | Copy 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); | |
The behavior of this property depends on if it is a Get or Set operation:
- When getting MessageStream.Text this property returns the first "text/plain" or "text/html" part contained within MessageStream.Parts.Simple. If there are none there, this property returns the first "text/plain" or "text/html" part that appears inside a multi-part part in MessageStream.Parts.Complex, from a recursive search. If there is no "text/plain" or "text/html" inline part in the message, this returns MessageStream.NonMime.Text. If there is no non-MIME text, this property returns an empty string.
- When setting MessageStream.Text this property adds a new MessagePartStream containing this text to the MessageStream.Parts.Simple collection. If no other parts are added to the MessageStream, the resulting message will be single part, unless MessageStream.ContentType is set to be multipart.
The SMTP protocol dictates that text lines should not exceed 1000 characters (CRLFs are used as line breaks). Most SMTP servers are tolerant of longer lines, but some may strictly adhere to the protocol. To ensure that all SMTP servers accept a message, it is recommended that CRLFs are used to break up lines to fewer than 1000 characters.
Target Platforms: Microsoft .NET Framework 2.0
Copy Code