SmtpClient class
Low-level SMTP library for Dart
Compliant to Extended SMTP standard.
Constructors
- SmtpClient(String clientDomain, {EventBus? bus, bool isLogEnabled = false, String? logName, bool onBadCertificate(X509Certificate)?})
-
Creates a new instance with the specified
clientDomain
that is associated with your service's domain, e.g.domain.com
orenough.de
.
Properties
- connectionInfo ↔ ConnectionInfo
-
Information about the connection
getter/setter pairinherited
- eventBus → EventBus
-
Allows to listens for events
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConnected → bool
-
Ist the client currently connected?
no setterinherited
- isLogEnabled ↔ bool
-
true
when the log is enabledgetter/setter pairinherited - isLoggedIn ↔ bool
-
true
after the user has authenticatedgetter/setter pairinherited - isSocketClosingExpected ↔ bool
-
true
when it is expected that the socket is closedgetter/setter pairinherited - logName ↔ String?
-
The name shown in log entries to differentiate this server
getter/setter pairinherited
- onBadCertificate → (bool Function(X509Certificate)?)
-
Handles unverifiable certificates.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serverInfo ↔ SmtpServerInfo
-
Information about the SMTP service
getter/setter pair
Methods
-
authenticate(
String name, String password, [AuthMechanism authMechanism = AuthMechanism.plain]) → Future< SmtpResponse> -
Signs in the user with the given
name
andpassword
. -
connect(
Socket socket, {ConnectionInfo? connectionInformation}) → void -
Starts to listen on the given
socket
.inherited -
connectToServer(
String host, int port, {bool isSecure = true, Duration timeout = const Duration(seconds: 20)}) → Future< ConnectionInfo> -
Connects to the specified server.
inherited
-
createClientError(
String message) → Object - Subclasses need to be able to create client specific exceptions
-
disconnect(
) → Future< void> -
Disconnects from the service
inherited
-
ehlo(
) → Future< SmtpResponse> - Issues the enhanced helo command to find out the service capabilities
-
log(
dynamic logObject, {bool isClient = true, String? initial}) → void -
Logs the data
inherited
-
logApp(
dynamic logObject) → void -
Logs the data from the app-side
inherited
-
logClient(
dynamic logObject) → void -
Logs the data from the client-side
inherited
-
logServer(
dynamic logObject) → void -
Logs the data from the server-side
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onConnectionDone(
) → void -
Informs about a closed connection
inherited
-
onConnectionError(
dynamic error) → void - Is called when the connection encountered an error
-
onConnectionEstablished(
ConnectionInfo connectionInfo, String serverGreeting) → FutureOr< void> - Is called after the initial connection has been established
-
onDataReceived(
Uint8List data) → void - Is called when data is received
-
onServerResponse(
List< String> responseTexts) → void - Handles server responses
-
quit(
) → Future< SmtpResponse> - Signs the user out and terminates the connection
-
sendChunkedMessage(
MimeMessage message, {bool use8BitEncoding = false, MailAddress? from, List< MailAddress> ? recipients}) → Future<SmtpResponse> -
Sends the specified
message
using theBDAT
SMTP command. -
sendChunkedMessageData(
MimeData data, MailAddress from, List< MailAddress> recipients, {bool use8BitEncoding = false}) → Future<SmtpResponse> -
Sends the specified message
data
from
to therecipients
using theBDAT
SMTP command. -
sendChunkedMessageText(
String text, MailAddress from, List< MailAddress> recipients, {bool use8BitEncoding = false}) → Future<SmtpResponse> -
Sends the specified message
text
from
to therecipients
using theBDAT
SMTP command. -
sendCommand(
SmtpCommand command) → Future< SmtpResponse> - Sends the command to the server
-
sendMessage(
MimeMessage message, {bool use8BitEncoding = false, MailAddress? from, List< MailAddress> ? recipients}) → Future<SmtpResponse> -
Sends the specified
message
. -
sendMessageData(
MimeData data, MailAddress from, List< MailAddress> recipients, {bool use8BitEncoding = false}) → Future<SmtpResponse> -
Sends the specified message
data
from
to therecipients
. -
sendMessageText(
String text, MailAddress from, List< MailAddress> recipients, {bool use8BitEncoding = false}) → Future<SmtpResponse> -
Sends the specified message
text
from
to therecipients
. -
startTls(
) → Future< SmtpResponse> - Upgrades the current insure connection to SSL.
-
toString(
) → String -
A string representation of this object.
inherited
-
upgradeToSslSocket(
) → Future< void> -
Upgrades the current connection to a secure socket
inherited
-
writeData(
List< int> data, [dynamic logObject]) → Future -
Writes the specified
data
.inherited -
writeText(
String text, [dynamic logObject, Duration? timeout]) → Future -
Writes the specified
text
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited