| Visual Basic (Declaration) | |
|---|---|
Public Overloads Function Send( _ ByVal toAddress As String, _ ByVal fromAddress As String, _ ByVal subject As String, _ ByVal body As String _ ) As SmtpResult | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As Smtp Dim toAddress As String Dim fromAddress As String Dim subject As String Dim body As String Dim value As SmtpResult value = instance.Send(toAddress, fromAddress, subject, body) | |
| C# | |
|---|---|
public SmtpResult Send( string toAddress, string fromAddress, string subject, string body ) | |
| Managed Extensions for C++ | |
|---|---|
public: SmtpResult* Send( string* toAddress, string* fromAddress, string* subject, string* body ) | |
| C++/CLI | |
|---|---|
public: SmtpResult^ Send( String^ toAddress, String^ fromAddress, String^ subject, String^ body ) | |
Parameters
- toAddress
- Recipient of the email.
- fromAddress
- Sender of the email.
- subject
- Subject of the email.
- body
- Body text of the email.
Return Value
A SmtpResult object that describes the sent message.| Exception | Description |
|---|---|
| Dart.PowerTCP.Mail.ProtocolException | Bad SMTP protocol response received from server. |
| System.Net.Sockets.SocketException | The requested address is not valid in its context. |
| System.IO.IOException | The filename, directory name, or volume label syntax is incorrect. |
| System.ArgumentException | A required argument contains invalid characters, is empty, or contains only white spaces. |
The following example demonstrates sending an email message as quickly and easily as possible.
| Visual Basic | Copy Code |
|---|---|
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail" ' at the top of your class. ' Set the server Smtp1.Server = "mail.test.com" ' Send a message Smtp1.Send("you@dart.com", "me@dart.com", "test", "this is a test") | |
| C# | Copy Code |
|---|---|
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;" // at the top of your class. // Set the server smtp1.Server = "mail.test.com"; // Send a message smtp1.Send("you@dart.com", "me@dart.com", "test", "this is a test"); | |
This method represents the quickest and easiest way to send a basic text email. A SmtpResult object is returned containing data about the message sent such as the number of bytes of data sent.
To send a basic text email asynchronously, use Smtp.BeginSend.
Use this method if you simply want to send a basic text email to a single recipient as quickly as possible.
Target Platforms: Microsoft .NET Framework 2.0