XU XUv0.16.0

#net/smtp

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

XuAPI
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

XuAPI
pub fn new_client() Client

Purpose

Construct client.

Parameters

No arguments are required.

Returns

Client — a value of this type

($&Client) dial

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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