#net/smtp
Xu 0.16.0 API
import: #net/smtp
counts: 1 functions, 9 methods, 1 types, 0 constants, 0 method sets
SMTP client: EHLO/MAIL/RCPT/DATA/QUIT. No AUTH.
struct Client
pub struct Client {
pub buf string
pub did_hello int
pub local_name string
pub sticky string
}
Purpose
Smtp Client session maintaining connection and operations.
Public fields
buf string- buffer
did_hello int- field (int)
local_name string- field (string)
sticky string- field (string)
new_client
pub fn new_client() Client
Purpose
Construct client.
Parameters
No arguments are required.
Returns
Client — a value of this type
($&Client) dial
pub fn (c $&Client) dial(addr string) int
Purpose
Operation on $&Client: dial a connection. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
addr string- address (string)
Returns
int — a value of this type
($&Client) dial_timeout
pub fn (c $&Client) dial_timeout(addr string, timeout_ns int) int
Purpose
Operation on $&Client: dial timeout. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
addr string- address (string)
timeout_ns int- timeout in nanoseconds (int)
Returns
int — a value of this type
($&Client) hello
pub fn (c $&Client) hello(name &string) int
Purpose
Execute hello on $&Client. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
name &string- name (read-only borrow; caller keeps the original; type &string)
Returns
int — a value of this type
($&Client) mail
pub fn (c $&Client) mail(from &string) int
Purpose
Execute mail on $&Client. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
from &string- from (read-only borrow; caller keeps the original; type &string)
Returns
int — a value of this type
($&Client) rcpt
pub fn (c $&Client) rcpt(to &string) int
Purpose
Execute rcpt on $&Client. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
to &string- to (read-only borrow; caller keeps the original; type &string)
Returns
int — a value of this type
($&Client) data
pub fn (c $&Client) data(body &string) int
Purpose
Execute data on $&Client. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
body &string- body (read-only borrow; caller keeps the original; type &string)
Returns
int — a value of this type
($&Client) send_mail
pub fn (c $&Client) send_mail(from &string, to &string, body &string) int
Purpose
Operation on $&Client: send mail. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
from &string- from (read-only borrow; caller keeps the original; type &string)
to &string- to (read-only borrow; caller keeps the original; type &string)
body &string- body (read-only borrow; caller keeps the original; type &string)
Returns
int — a value of this type
($&Client) quit
pub fn (c $&Client) quit() int
Purpose
Execute quit on $&Client. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
Returns
int — a value of this type
($&Client) close
pub fn (c $&Client) close() int
Purpose
Operation on $&Client: close the resource. Throws on failure; handle the error or propagate it to the caller.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
Returns
int — a value of this type