LumiSoft Net Help
SMTP_Client Class
NamespacesLumiSoft.Net.SMTP.ClientSMTP_Client
This class implements SMTP client. Defined in RFC 5321.
Declaration Syntax
C#Visual BasicVisual C++F#
public class SMTP_Client : TCP_Client
Public Class SMTP_Client
	Inherits TCP_Client
public ref class SMTP_Client : public TCP_Client
type SMTP_Client =  
    class
        inherit TCP_Client
    end
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
SMTP_Client()()()()
Default constructor.

Auth(AUTH_SASL_Client)
Sends AUTH command to SMTP server.

AuthAsync(SMTP_Client..::..AuthAsyncOP)
Starts sending AUTH command to SMTP server.

Authenticate(String, String) Obsolete.
Authenticates user. Authenticate method chooses strongest possible authentication method supported by server, preference order DIGEST-MD5 -> CRAM-MD5 -> LOGIN.

AuthenticatedUserIdentity
Gets session authenticated user identity, returns null if not authenticated.
(Overrides TCP_Session.AuthenticatedUserIdentity.)
AuthGetStrongestMethod(String, String)
Gets strongest authentication method which we can support from SMTP server. Preference order DIGEST-MD5 -> CRAM-MD5 -> LOGIN -> PLAIN.

BdatEnabled Obsolete.
Gets or sets if BDAT command can be used.

BeginAuthenticate(String, String, AsyncCallback, Object) Obsolete.
Starts authentication.

BeginConnect(String, Int32, AsyncCallback, Object) Obsolete.
Starts connection to the specified host.
(Inherited from TCP_Client.)
BeginConnect(String, Int32, Boolean, AsyncCallback, Object) Obsolete.
Starts connection to the specified host.
(Inherited from TCP_Client.)
BeginConnect(IPEndPoint, Boolean, AsyncCallback, Object) Obsolete.
Starts connection to the specified remote end point.
(Inherited from TCP_Client.)
BeginConnect(IPEndPoint, IPEndPoint, Boolean, AsyncCallback, Object) Obsolete.
Starts connection to the specified remote end point.
(Inherited from TCP_Client.)
BeginDisconnect(AsyncCallback, Object)
Starts disconnecting connection.
(Inherited from TCP_Client.)
BeginGetDomainHosts(String, AsyncCallback, Object) Obsolete.
Starts getting specified email domain SMTP hosts.

BeginMailFrom(String, Int64, AsyncCallback, Object) Obsolete.
Starts sending MAIL FROM: command to SMTP server.

BeginMailFrom(String, Int64, SMTP_DSN_Ret, String, AsyncCallback, Object) Obsolete.
Starts sending MAIL FROM: command to SMTP server.

BeginNoop(AsyncCallback, Object) Obsolete.
Starts sending NOOP command to server. This method can be used for keeping connection alive(not timing out).

BeginRcptTo(String, AsyncCallback, Object) Obsolete.
Starts sending RCPT TO: command to SMTP server.

BeginRcptTo(String, SMTP_DSN_Notify, String, AsyncCallback, Object) Obsolete.
Starts sending RCPT TO: command to SMTP server.

BeginReset(AsyncCallback, Object) Obsolete.
Starts resetting SMTP session, all state data will be deleted.

BeginSendMessage(Stream, AsyncCallback, Object) Obsolete.
Starts sending specified raw message to SMTP server.

BeginStartTLS(AsyncCallback, Object) Obsolete.
Starts switching to SSL.

Connect(String, Int32)
Connects to the specified host. If the hostname resolves to more than one IP address, all IP addresses will be tried for connection, until one of them connects.
(Inherited from TCP_Client.)
Connect(String, Int32, Boolean)
Connects to the specified host. If the hostname resolves to more than one IP address, all IP addresses will be tried for connection, until one of them connects.
(Inherited from TCP_Client.)
Connect(IPEndPoint, Boolean)
Connects to the specified remote end point.
(Inherited from TCP_Client.)
Connect(IPEndPoint, IPEndPoint, Boolean)
Connects to the specified remote end point.
(Inherited from TCP_Client.)
Connect(IPEndPoint, IPEndPoint, Boolean, RemoteCertificateValidationCallback)
Connects to the specified remote end point.
(Inherited from TCP_Client.)
ConnectAsync(TCP_Client..::..ConnectAsyncOP)
Starts connecting to remote end point.
(Inherited from TCP_Client.)
ConnectTime
Gets the time when session was connected.
(Inherited from TCP_Client.)
Disconnect()()()()
Closes connection to SMTP server.
(Overrides TCP_Client.Disconnect()()()().)
Disconnect(Boolean)
Closes connection to SMTP server.

Dispose()()()()
Clean up any resources being used.
(Overrides TCP_Client.Dispose()()()().)
EhloHelo(String)
Sends EHLO/HELO command to SMTP server.

EhloHeloAsync(SMTP_Client..::..EhloHeloAsyncOP)
Starts sending EHLO/HELO command to SMTP server.

EndAuthenticate(IAsyncResult) Obsolete.
Ends a pending asynchronous authentication request.

EndConnect(IAsyncResult) Obsolete.
Ends a pending asynchronous connection request.
(Inherited from TCP_Client.)
EndDisconnect(IAsyncResult)
Ends a pending asynchronous disconnect request.
(Inherited from TCP_Client.)
EndGetDomainHosts(IAsyncResult) Obsolete.
Ends a pending asynchronous BeginGetDomainHosts request.

EndMailFrom(IAsyncResult) Obsolete.
Ends a pending asynchronous MailFrom request.

EndNoop(IAsyncResult) Obsolete.
Ends a pending asynchronous Noop request.

EndRcptTo(IAsyncResult) Obsolete.
Ends a pending asynchronous RcptTo request.

EndReset(IAsyncResult) Obsolete.
Ends a pending asynchronous reset request.

EndSendMessage(IAsyncResult) Obsolete.
Ends a pending asynchronous SendMessage request.

EndStartTLS(IAsyncResult) Obsolete.
Ends a pending asynchronous StartTLS request.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
EsmtpFeatures
Gets what ESMTP features are supported by connected SMTP server.

Finalize()()()()
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
GetDomainHosts(String) Obsolete.
Gets specified email domain SMTP hosts. Values are in descending priority order.

GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
GreetingText
Gets greeting text which was sent by SMTP server.

ID
Gets session ID.
(Inherited from TCP_Client.)
IsAuthenticated
Gets if this session is authenticated.
(Inherited from TCP_Session.)
IsConnected
Gets if TCP client is connected.
(Inherited from TCP_Client.)
IsDisposed
Gets if this object is disposed.
(Inherited from TCP_Client.)
IsEsmtpSupported
Gets if connected SMTP server suports ESMTP.

IsSecureConnection
Gets if this session TCP connection is secure connection.
(Inherited from TCP_Client.)
LastActivity
Gets the last time when data was sent or received.
(Inherited from TCP_Client.)
LocalEndPoint
Gets session local IP end point.
(Inherited from TCP_Client.)
LocalHostName
Gets or sets host name which is reported to SMTP server. If value null, then local computer name is used.

LogAddException(String, Exception)
Logs exception.
(Inherited from TCP_Client.)
LogAddRead(Int64, String)
Logs read operation.
(Inherited from TCP_Client.)
LogAddText(String)
Logs free text entry.
(Inherited from TCP_Client.)
LogAddWrite(Int64, String)
Logs write operation.
(Inherited from TCP_Client.)
Logger
Gets or sets TCP client logger. Value null means no logging.
(Inherited from TCP_Client.)
MailFrom(String, Int64)
Sends MAIL command to SMTP server.

MailFrom(String, Int64, SMTP_DSN_Ret, String)
Sends MAIL command to SMTP server.

MailFromAsync(SMTP_Client..::..MailFromAsyncOP)
Starts sending MAIL command to SMTP server.

MaxAllowedMessageSize
Gets maximum message size in bytes what SMTP server accepts. Value null means not known.

MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Noop()()()()
Send NOOP command to server. This method can be used for keeping connection alive(not timing out).

NoopAsync(SMTP_Client..::..NoopAsyncOP)
Starts sending NOOP command to SMTP server. This method can be used for keeping connection alive(not timing out).

OnConnected(TCP_Client..::..CompleteConnectCallback)
This method is called when TCP client has sucessfully connected.
(Overrides TCP_Client.OnConnected(TCP_Client..::..CompleteConnectCallback).)
OnConnected()()()()
This method is called after TCP client has sucessfully connected.
(Inherited from TCP_Client.)
OnError(Exception) Obsolete.
This must be called when unexpected error happens. When inheriting TCP_Client class, be sure that you call OnError method for each unexpected error.
(Inherited from TCP_Client.)
QuickSend(Mime) Obsolete.
Sends specified mime message.

QuickSend(Mail_Message)
Sends specified mime message.

QuickSend(String, String, Stream)
Sends message directly to email domain. Domain email sever resolve order: MX recordds -> A reords if no MX.

QuickSend(String, String, String, Stream)
Sends message directly to email domain. Domain email sever resolve order: MX recordds -> A reords if no MX.

QuickSendSmartHost(String, Int32, Boolean, Mail_Message)
Sends message by using specified smart host.

QuickSendSmartHost(String, String, Int32, Boolean, String, String, Mail_Message)
Sends message by using specified smart host.

QuickSendSmartHost(String, Int32, String, array<String>[]()[][], Stream)
Sends message by using specified smart host.

QuickSendSmartHost(String, Int32, Boolean, String, array<String>[]()[][], Stream)
Sends message by using specified smart host.

QuickSendSmartHost(String, String, Int32, Boolean, String, array<String>[]()[][], Stream)
Sends message by using specified smart host.

QuickSendSmartHost(String, String, Int32, Boolean, String, String, String, array<String>[]()[][], Stream)
Sends message by using specified smart host.

RcptTo(String)
Sends RCPT TO: command to SMTP server.

RcptTo(String, SMTP_DSN_Notify, String)
Sends RCPT TO: command to SMTP server.

RcptToAsync(SMTP_Client..::..RcptToAsyncOP)
Starts sending RCPT command to SMTP server.

ReadLine()()()()
Reads and logs specified line from connected host.
(Inherited from TCP_Client.)
RemoteEndPoint
Gets session remote IP end point.
(Inherited from TCP_Client.)
RemoteHostName
Gets SMTP server host name which it reported to us.

Reset()()()() Obsolete.
Resets SMTP session, all state data will be deleted.

Rset()()()()
Send RSET command to server.

RsetAsync(SMTP_Client..::..RsetAsyncOP)
Starts sending RSET command to SMTP server.

SaslAuthMethods
Gets SMTP server supported SASL authentication method.

SendMessage(Stream)
Sends raw message to SMTP server.

SendMessage(Stream, Boolean)
Sends raw message to SMTP server.

SendMessageAsync(SMTP_Client..::..SendMessageAsyncOP)
Starts sending message to SMTP server.

StartTLS()()()()
Sends STARTTLS command to SMTP server.

StartTLS(RemoteCertificateValidationCallback)
Sends STARTTLS command to SMTP server.

StartTlsAsync(SMTP_Client..::..StartTlsAsyncOP)
Starts sending STARTTLS command to SMTP server.

SwitchToSecure()()()()
Switches session to secure connection.
(Inherited from TCP_Client.)
SwitchToSecureAsync(TCP_Client..::..SwitchToSecureAsyncOP)
Starts switching connection to secure.
(Inherited from TCP_Client.)
TcpStream
Gets TCP stream which must be used to send/receive data through this session.
(Inherited from TCP_Client.)
Timeout
Gets or sets default TCP read/write timeout.
(Inherited from TCP_Client.)
ToString()()()()
Returns a string that represents the current object.
(Inherited from Object.)
ValidateCertificateCallback
Gets or stes remote callback which is called when remote server certificate needs to be validated. Value null means not sepcified.
(Inherited from TCP_Client.)
WriteLine(String)
Sends and logs specified line to connected host.
(Inherited from TCP_Client.)
Examples
Simple way:
 Copy imageCopy
/*
 To make this code to work, you need to import following namespaces:
 using LumiSoft.Net.SMTP.Client; */


// You can send any valid SMTP message here, from disk,memory, ... or
// you can use LumiSoft.Net.Mail classes to compose valid SMTP mail message.

// SMTP_Client.QuickSendSmartHost(...
or
// SMTP_Client.QuickSend(...
Advanced way:
 Copy imageCopy
/*
 To make this code to work, you need to import following namespaces:
 using LumiSoft.Net.SMTP.Client; */


using(SMTP_Client smtp = new SMTP_Client()){      
    // You can use Dns_Client.GetEmailHosts(... to get target recipient SMTP hosts for Connect method.
    smtp.Connect("hostName",WellKnownPorts.SMTP); 
    smtp.EhloHelo("mail.domain.com");
    // Authenticate if target server requires.
    // smtp.Auth(smtp.AuthGetStrongestMethod("user","password"));
    smtp.MailFrom("sender@domain.com");
    // Repeat this for all recipients.
    smtp.RcptTo("to@domain.com");

    // Send message to server.
    // You can send any valid SMTP message here, from disk,memory, ... or
    // you can use LumiSoft.Net.Mail classes to compose valid SMTP mail message.
    // smtp.SendMessage(.... .

    smtp.Disconnect();
}
Inheritance Hierarchy

Assembly: LumiSoft.Net (Module: LumiSoft.Net.dll) Version: 4.5.5510.19119