mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples: fix unset reader notice for the smtp/mail example (#17998)
This commit is contained in:
parent
d3dbd7b743
commit
353de60158
@ -31,6 +31,6 @@ fn main() {
|
||||
body_type: .html
|
||||
body: body
|
||||
}
|
||||
mut client := smtp.new_client(client_cfg) or { panic('Error configuring smtp') }
|
||||
client.send(send_cfg) or { panic('Error resolving email address') }
|
||||
mut client := smtp.new_client(client_cfg) or { panic('Error with configuring smtp: ${err}') }
|
||||
client.send(send_cfg) or { panic('Error resolving email address: ${err}') }
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ pub struct Client {
|
||||
mut:
|
||||
conn net.TcpConn
|
||||
ssl_conn &ssl.SSLConn = unsafe { nil }
|
||||
reader io.BufferedReader
|
||||
reader ?&io.BufferedReader
|
||||
pub:
|
||||
server string
|
||||
port int = 25
|
||||
@ -139,7 +139,7 @@ fn (mut c Client) connect_ssl() ! {
|
||||
fn (mut c Client) expect_reply(expected ReplyCode) ! {
|
||||
mut str := ''
|
||||
for {
|
||||
str = c.reader.read_line()!
|
||||
str = c.reader or { return error('the Client.reader field is not set') }.read_line()!
|
||||
if str.len < 4 {
|
||||
return error('Invalid SMTP response: ${str}')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user