client
pub fn client(endpoint string) SmtpClientPurpose
client; returns SmtpClient.
Parameters
endpointstring- endpoint (string)
Returns
SmtpClient — a value of this type
API
#github.com/xulang-org/packages/smtpExternal package `smtp #github.com/xulang-org/packages/smtp`, provided by github.com/xulang-org/packages.
github.com/xulang-org/packages · 0.1.1 · Install and use
clientpub fn client(endpoint string) SmtpClientclient; returns SmtpClient.
endpoint stringSmtpClient — a value of this type
poolpub fn pool(endpoint string, max_conns int) SmtpPoolpool; returns SmtpPool.
endpoint stringmax_conns intSmtpPool — a value of this type
struct Messagepub struct Message {
pub from string
pub to string
pub subject string
pub body string
}Public struct `Message`.
from stringto stringsubject stringbody stringstruct SmtpClientpub struct SmtpClient {
pub host string
pub port int
pub username string
pub password string
}Public struct `SmtpClient`.
host stringport intusername stringpassword stringstruct SmtpResponsepub struct SmtpResponse {
pub code int
pub text string
}Public struct `SmtpResponse`.
code inttext stringread_responsepub fn read_response(fd int) SmtpResponseReads single-line or multi-line SMTP response 250-first line 250-second line 250 final line Throws on failure.
fd intSmtpResponse — a value of this type
new_clientpub fn new_client(endpoint string) SmtpClientConstruct client.
endpoint stringSmtpClient — a value of this type
(SmtpClient) connectpub fn (c SmtpClient) connect() intCall `connect` on `SmtpClient`. Throws on failure.
c SmtpClientint — a value of this type
(SmtpClient) send_mail_on_fdpub fn (c SmtpClient) send_mail_on_fd(fd int, msg Message) boolMethod on `SmtpClient`: send mail on fd. Throws on failure.
c SmtpClientfd intmsg Messagebool — true or false
(SmtpClient) close_connpub fn (c SmtpClient) close_conn(fd int)Method on `SmtpClient`: close connection.
c SmtpClientfd intstruct SmtpPoolpub struct SmtpPool {
pub client SmtpClient
pub idle chan int
pub max_idle int
}Public struct `SmtpPool`.
client SmtpClientidle chan intmax_idle intopen_poolpub fn open_pool(endpoint string, max_idle int) SmtpPoolOpen pool.
endpoint stringmax_idle intSmtpPool — a value of this type
(&SmtpPool) get_connpub fn (p &SmtpPool) get_conn() intMethod on `&SmtpPool`: read conn.
p &SmtpPoolint — a value of this type
(&SmtpPool) put_connpub fn (p &SmtpPool) put_conn(fd int)Method on `&SmtpPool`: put connection.
p &SmtpPoolfd int(&SmtpPool) send_mailpub fn (p &SmtpPool) send_mail(msg Message) boolConvenient delegate to send mail borrowing from pool Throws on failure.
p &SmtpPoolmsg Messagebool — true or false
(&SmtpPool) closepub fn (p &SmtpPool) close()Method on `&SmtpPool`: close the resource.
p &SmtpPool