net.smtp #

fn new_client #

fn new_client(config Client) ?&Client

new_client returns a new SMTP client and connects to it

enum BodyType #

enum BodyType {
	text
	html
}

struct Client #

struct Client {
mut:
	conn   net.TcpConn
	reader io.BufferedReader
pub:
	server   string
	port     int = 25
	username string
	password string
	from     string
pub mut:
	is_open bool
}

fn (Client) reconnect #

fn (mut c Client) reconnect() ?

reconnect reconnects to the SMTP server if the connection was closed

fn (Client) send #

fn (mut c Client) send(config Mail) ?

send sends an email

fn (Client) quit #

fn (mut c Client) quit() ?

quit closes the connection to the server

struct Mail #

struct Mail {
	from      string
	to        string
	cc        string
	bcc       string
	date      time.Time = time.now()
	subject   string
	body_type BodyType
	body      string
}