PowerTCP Mail for .NET
Send(String,String,String,String) Method
See Also  Example Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Smtp Class > Send Method : Send(String,String,String,String) Method




toAddress
Recipient of the email.
fromAddress
Sender of the email.
subject
Subject of the email.
body
Body text of the email.
Synchronously send a basic text email.

Syntax

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.

Exceptions

ExceptionDescription
Dart.PowerTCP.Mail.ProtocolExceptionBad SMTP protocol response received from server.
System.Net.Sockets.SocketExceptionThe requested address is not valid in its context.
System.IO.IOExceptionThe filename, directory name, or volume label syntax is incorrect.
System.ArgumentExceptionA required argument contains invalid characters, is empty, or contains only white spaces.

Example

The following example demonstrates sending an email message as quickly and easily as possible.
Visual BasicCopy 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");

Remarks

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.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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