| Visual Basic (Declaration) | |
|---|---|
Public Property From As MailAddress | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As MessageStream Dim value As MailAddress instance.From = value value = instance.From | |
| C# | |
|---|---|
public MailAddress From {get; set;} | |
| Managed Extensions for C++ | |
|---|---|
public: __property MailAddress* get_From(); public: __property void set_From( MailAddress* value ); | |
| C++/CLI | |
|---|---|
public: property MailAddress^ From { MailAddress^ get(); void set ( MailAddress^ value); } | |
Property Value
MailAddress objectThe 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); | |
This property is a MailAddress object specifying who the email is from. To set this property, simply create a new instance of a MailAddress object and set it equal to this property.
Setting this property causes the "FROM:" header line to be added to the message and the value of this property is sent after the SMTP "MAIL FROM" command. If you do not wish for this to occur, simply do not set this property and set the Smtp.MailFrom property, the value of which will be sent after the SMTP "MAIL FROM" command but will not be added to the header.
Target Platforms: Microsoft .NET Framework 2.0
Copy Code