XU XUv0.8.8
中文

API

#net/smtp

import: #net/smtp

counts: 1 fns, 8 methods, 1 types, 0 consts, 0 ifaces

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 subset aligned with `net/smtp` Client: Dial + EHLO/HELO + MAIL + RCPT + DATA + QUIT over existing IPv4 TCP. No TLS, AUTH, or SendMail STARTTLS. Client is filled in-place (no Result<Client> in this subset — Dial still mutates a caller-owned client).

Parameters

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

none

Returns

Client — a value of this type

(&mut Client) dial

XuAPI
pub fn (c &mut Client) dial(addr string) int

Purpose

Method on `&mut Client`: dial a connection. Throws on failure.

Parameters

c &mut Client
receiver &mut Client (exclusive borrow)
addr string
address (string)

Returns

int — a value of this type

(&mut Client) hello

XuAPI
pub fn (c &mut Client) hello(name &string) int

Purpose

Call `hello` on `&mut Client`. Throws on failure.

Parameters

c &mut Client
receiver &mut Client (exclusive borrow)
name &string
name (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

(&mut Client) mail

XuAPI
pub fn (c &mut Client) mail(from &string) int

Purpose

Call `mail` on `&mut Client`. Throws on failure.

Parameters

c &mut Client
receiver &mut Client (exclusive borrow)
from &string
from (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

(&mut Client) rcpt

XuAPI
pub fn (c &mut Client) rcpt(to &string) int

Purpose

Call `rcpt` on `&mut Client`. Throws on failure.

Parameters

c &mut Client
receiver &mut Client (exclusive borrow)
to &string
to (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

(&mut Client) data

XuAPI
pub fn (c &mut Client) data(body &string) int

Purpose

Call `data` on `&mut Client`. Throws on failure.

Parameters

c &mut Client
receiver &mut Client (exclusive borrow)
body &string
body (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

(&mut Client) send_mail

XuAPI
pub fn (c &mut Client) send_mail(from &string, to &string, body &string) int

Purpose

Method on `&mut Client`: send mail. Throws on failure.

Parameters

c &mut Client
receiver &mut Client (exclusive borrow)
from &string
from (borrowed; caller keeps it; type &string)
to &string
to (borrowed; caller keeps it; type &string)
body &string
body (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

(&mut Client) quit

XuAPI
pub fn (c &mut Client) quit() int

Purpose

Call `quit` on `&mut Client`. Throws on failure.

Parameters

c &mut Client
receiver &mut Client (exclusive borrow)

Returns

int — a value of this type

(&mut Client) close

XuAPI
pub fn (c &mut Client) close() int

Purpose

Method on `&mut Client`: close the resource. Throws on failure.

Parameters

c &mut Client
receiver &mut Client (exclusive borrow)

Returns

int — a value of this type