Smtp.NET 3 Documentation

SmtpServer.SendQuick Method 

Sends simple message that does not allow any other parameters or properties to be set.

[Visual Basic]
Public Shared Function SendQuick( _
   ByVal sToAddress As String, _
   ByVal sFromAddress As String, _
   ByVal sSubject As String, _
   ByVal sBody As String _
) As ReturnCodes
[C#]
public static ReturnCodes SendQuick(
   string sToAddress,
   string sFromAddress,
   string sSubject,
   string sBody
);

Parameters

sToAddress
The "to" email address
sFromAddress
The "from" email address
sSubject
The "subject" of the email
sBody
The "body" of the email

Return Value

An enumerated value of ReturnCodes

Remarks

Example

[C#]
            public void Send()
            {
                 ReturnCodes nRC = SmtpServer.SendQuick("to@email.com", "from@email.com", "Subject", "This is a test message");
                 if ( nRC != ReturnCodes.SUCCESS )
                 {
                      Console.Write("Error #"+nRC+" occurred.");
                 }
                 else
                 {
                      Console.Write(oSmtpDotNet.LogFileToString(false));
                 }
            }
            
[VB]
            Public Function Send() As Integer
                 Dim nRC As ReturnCodes
                 nRC = SmtpServer.SendQuick("to@email.com", "from@email.com", "Subject", "This is a test message");
                 If (nRC <> ReturnCodes.SUCCESS) Then
                     Console.Write("Error #"+nRC+" occurred.");
                 Else
                     ' Success!
                     Console.WriteLine("Message Sent!")
                 End If
            End Function
            

See Also

SmtpServer Class | SmtpServer Members | SmtpDotNet Namespace | ReturnCodes | Send