Object built-in object

Object Smtp

Smtp object

Inheritance

Constructor

Smtp

Smtp object constructor

1
new Smtp();

Member attributes

timeout

Integer, query and set the timeout time in milliseconds

1
Integer Smtp.timeout;

socket

Stream , query the Socket currently connected to the Smtp object

1
readonly Stream Smtp.socket;

Member function

connect

Build to the specified server

1
Smtp.connect(String url) async;

Call parameters:

  • url : String, specify the connection protocol, it can be: tcp://host:port or ssl ://host:port

command

Send the specified command and return a response, if the server reports an error, an error will be thrown

1 2
String Smtp.command(String cmd, String arg) async;

Call parameters:

  • cmd : String, command name
  • arg : String, parameter

Return result:

  • String , if successful, return server response

hello

Send HELO command, if the server reports an error, an error will be thrown

1
Smtp.hello(String hostname = "localhost") async;

Call parameters:

  • hostname : String, host name, the default is "localhost"

login

Log in to the server with the specified user and password, if the server reports an error, an error will be thrown

1 2
Smtp.login(String username, String password) async;

Call parameters:

  • username : String, username
  • password : String, password

from

Specify the sender's mailbox, if the server reports an error, an error will be thrown

1
Smtp.from(String address) async;

Call parameters:

  • address : String, sender's mailbox

to

Specify the recipient's mailbox, if the server reports an error, an error will be thrown

1
Smtp.to(String address) async;

Call parameters:

  • address : String, recipient mailbox

data

Send text to the recipient, if the server reports an error, an error will be thrown

1
Smtp.data(String txt) async;

Call parameters:

  • txt : String, the text to be sent

quit

Exit and close the connection, if the server reports an error, an error will be thrown

1
Smtp.quit() async;

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics

1
String Smtp.toString();

Return result:

  • String , returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

1
Value Smtp.toJSON(String key = "");

Call parameters:

  • key : String, unused

Return result:

  • Value , returns a value containing JSON serializable