API
#net/smtp
Xu 0.8.8 API
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
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
pub fn new_client() Client
Purpose
Construct client.
Parameters
none
Returns
Client — a value of this type
(&mut Client) dial
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
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
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
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
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
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
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
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