Object Smtp
Smtp object
Inheritance
Constructor
Smtp
Smtp object constructor
1new Smtp();
Member attributes
timeout
Integer, query and set the timeout time in milliseconds
1Integer Smtp.timeout;
socket
Stream, Query the current connection of the Smtp object Socket
1readonly Stream Smtp.socket;
Member function
connect
Set up to the specified server
1Smtp.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
2String 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 a HELO command, if the server reports an error, an error will be thrown
1Smtp.hello(String hostname = "localhost") async;
Call parameters:
- hostname: String, host name, 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
2Smtp.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
1Smtp.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
1Smtp.to(String address) async;
Call parameters:
- address: String, recipient mailbox
data
Send the text to the recipient, if the server reports an error, an error will be thrown
1Smtp.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
1Smtp.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
1String 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
1Value Smtp.toJSON(String key = "");
Call parameters:
- key: String, unused
Return result:
- Value, Returns a value containing JSON serializable